Hello I need to write and read a parameter through a file to get
communication between two processes.
I know how to use fopen, fprintf. But I wonder how can I overwrite the
old files.
For instance, I need to write the value of A into a file. Another
process need to access the data of A.
Then the first process will overwrite the value of A.
How can I do that?
Thanks a lot! 5 1615 po***********@g mail.com wrote: Hello I need to write and read a parameter through a file to get communication between two processes. I know how to use fopen, fprintf. But I wonder how can I overwrite the old files. For instance, I need to write the value of A into a file. Another process need to access the data of A. Then the first process will overwrite the value of A.
Do a
rewind (file);
before you use fprintf() on the file.
- Logan po***********@g mail.com wrote: Hello I need to write and read a parameter through a file to get communication between two processes. I know how to use fopen, fprintf. But I wonder how can I overwrite the old files. For instance, I need to write the value of A into a file. Another process need to access the data of A. Then the first process will overwrite the value of A.
How can I do that?
Thanks a lot!
As you have tried to do it, what problems do you have?
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein --- po***********@g mail.com wrote: Hello I need to write and read a parameter through a file to get communication between two processes. I know how to use fopen, fprintf. But I wonder how can I overwrite the old files. For instance, I need to write the value of A into a file. Another process need to access the data of A. Then the first process will overwrite the value of A.
How can I do that?
Thanks a lot!
Insted of using files for giving communication between two process, you
can use either sockets or shared memory to do that
Best Regards,
Abdur
In article <11************ **********@z14g 2000cwz.googleg roups.com>, ab********@yaho o.co.in <ab********@yah oo.co.in> wrote:
.... Insted of using files for giving communication between two process, you can use either sockets or shared memory to do that
Allow me to be the first to say this - and I say it from the deepness of my
heart, with all the kindness and love one has come to associate with the
helpful posts you get in this newsgroup:
Not portable. Can't discuss it here. Blah, blah, blah.
On 18 Jan 2006 20:42:18 -0800, "ab********@yah oo.co.in"
<ab********@yah oo.co.in> wrote in comp.lang.c: po***********@g mail.com wrote: Hello I need to write and read a parameter through a file to get communication between two processes. I know how to use fopen, fprintf. But I wonder how can I overwrite the old files. For instance, I need to write the value of A into a file. Another process need to access the data of A. Then the first process will overwrite the value of A.
How can I do that?
Thanks a lot!
Insted of using files for giving communication between two process, you can use either sockets or shared memory to do that
The C language does not have sockets or shared memory. If your
platform does, it is a non-standard extension. And just because your
platform does, it does not mean that the OP's platform has the same
non-standard extensions.
And by the way, non-standard extensions are off-topic here.
--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://c-faq.com/
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.l earn.c-c++ http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: lawrence |
last post by:
I've been bad about documentation so far but I'm going to try to be
better. I've mostly worked alone so I'm the only one, so far, who's
suffered from my bad habits. But I'd like other programmers to have an
easier time understanding what I do. Therefore this weekend I'm going
to spend 3 days just writing comments. Before I do it, I thought I'd
ask other programmers what information they find useful.
Below is a typical class I've...
|
by: Mark Miller |
last post by:
I have a char array and when I write it to a file using BinaryWriter the
position of the pointer is the size of the array + 1. For example: writing
char leaves the pointer at position 26 after starting at position 0. I
thought that char was 2 bytes, but this makes it seem as though it is just 1
when I write to a file. Why is this? I imagine the extra bit is just a null
bit (correct me if I'm wrong). I don't know if this helps but when I...
|
by: Just Me |
last post by:
Using streams how do I write and then read a set of variables?
For example, suppose I want to write into a text file:
string1,string2,string3
Then read them later.
Suppose I want to write and then read:
string1, integer1, double1
|
by: Laszlo Nagy |
last post by:
This program:
import sys
import traceback
import cStringIO
a = 1.0
b = 0.0
try:
c=a/b
|
by: DC |
last post by:
The problem
I'm using the .NET GridView and FormView objects for the first time and
im getting the error "An OleDbParameter with ParameterName '@ID' is not
contained by this OleDbParameterCollection" whenI try to write a new record.
Delete and Modify work fine its just the add record function causes the
error.
| |
by: Demorsy |
last post by:
Disappointed, this is not the first time I'm posting this kind of a request
for help, but no helpful answer was posted yet.
I'll try make my question as clear as I can:
(1) I wish to write an XML file. this file will contain any number of
parameters to be used in my C# code as database.
(2) This file may contain any number of parameters, and I will know the
number of the parameters only at run time.
(3) Any parameter must have a name,...
|
by: Flyzone |
last post by:
I have a list of parameters.
I need to run in thread a command, one thread for one parameter.
So i made a for loop, creating 5 threads and waiting their stop with:
for parameter in parameters
Thread{
....
write on BW2
....
}
|
by: cmrhema |
last post by:
Hi All ,
I have with me a server socket program, I am receiving all the clients, but what happens is i have to write it into a file.
This consumes time.
So we do not have a data loss, but as the time taken to write into the log file increases, some of the data does not get written.
This is the code
//ONLY SHOBA
|
by: AAaron123 |
last post by:
trying to understand the below shown code.
After this is run the browser opens a file-save dialog box for saving the
file.
I wonder how it knows I want the file saved?
But more important, the dialog box has as the default file name the name of
this ashx file.
I'd like to make that name more meaningfull but don't know how it gets set.
I'm looking for a Response.Write but don't find one. Maybe that why the
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |