Mail Archives: djgpp/1999/09/15/08:34:47
Good documentation on the use of standard library function calls will provide
the function prototype *and* indicate all header files you should include.
That means that when you look up fopen(), fscanf(), fclose(), and fprintf(),
you shall include each and every one of the headers they name. In this case, I
can think of only one header that will cover you for the use of these calls.
On 17 Sep 99, Hakan Venderlof was found to have commented thusly:
> What include should be used for this?
>
>
> FILE *f;
> int v;
> f = fopen("variable.txt", "rt");
> fscanf(f, "%d", &v);
> fclose(f);
> f = fopen("variable.txt", "wt");
> fprintf(f, "%d\n", v);
> fclose(f);
>
>
>
> Hakan Venderlof wrote:
> >
> > Hello
> > I would like to load an variable from a file
> > 'variable.txt' looking like this:
> >
> > 25
> >
> > and then change the variable in a program and
> > save the variable to the samefile, eg overwriting the file
> > to for example
> >
> > 50
> >
> > How should this be written?
>
>
>
>
>
>
> *** greetings grok sweden ***
>
Mitch Halloran
Research (Bio)chemist
Duzen Laboratories Group
Ankara TURKEY
- Raw text -