File Handling
- From: "Mr B" <mrb_16@xxxxxxxxxxx>
- Date: 21 Mar 2007 13:02:19 -0700
Hi all,
I hoping somebody will be able to help me this a tedious problem I'm
having which I just can't seem to get right.
I open this file as a file I want to read and write to, it holds an
integer value.
I want to do this repeatedly, in this order:
1. fopen the file
2. read the value from the file
3. write a value to the file (overwriting the previous interger so
before there was 1 value, and after there is 1 value, the new one)
4. fclose the file.
fCurrProduction = fopen(CurrentProduction,"w+");
I have tried this way, but everytime i come to read from it in step 2
nothing exists in the file even though there was before the program
was run, it seems to wipe the value.
fCurrProduction = fopen(CurrentProduction,"r+");
This way seems to append the file when I want to overwrite
I manually set the files contents to zero, as i want to read an
initial value of zero from it at the beginning.
Can anybody help??
Thanks alot
Daniel
.
- Follow-Ups:
- Re: File Handling
- From: Jens Thoms Toerring
- Re: File Handling
- Prev by Date: Re: daemon caching weird exit status from a shell script
- Next by Date: Re: File Handling
- Previous by thread: system() function
- Next by thread: Re: File Handling
- Index(es):
Relevant Pages
|
|