i just want to know, if you are using an argv statement in your code, and you are defining two files (one for input one for output), called inFile and outFile, and you open the first in "r" mode and the second in "w" mode...... can you apply it to the same file?

i.e. can i say something like the following?:

inFile = fopen(argv[data.txt], "r");
     outFile = fopen(argv[data.txt], "w");

....will this work or do i need to put two different file names in each line?

In my experience you save yourself a lot of headaches by avoiding both sharing (working with the same file through two streams simultaneously) and read-write access (being able to read from and write to the file through a single stream).

ok, so what do you suggest for me to do?

i want to save a struct's values to a file, then bring those values back somehow, then do a calculation, and then display the final result......

.....i would have thought that it would be easier to use a single stream to read and write to a single file..... but if you have any other suggestions then please share.....

thanks.

>so what do you suggest for me to do?
I thought it was obvious:

Open file for writing.
Write to file.
Close file.
Open file for reading.
Read from file.
Close file.

>so what do you suggest for me to do?
I thought it was obvious:

Open file for writing.
Write to file.
Close file.
Open file for reading.
Read from file.
Close file.

ahhhhhhhhh....... ok, i get you..... what you meant was for me to use the file step by step...... no problem.... :cool:

This question has already been answered. Start a new discussion instead.