delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/09/15/08:34:47

Message-Id: <199909150808.LAA00604@ankara.Foo.COM>
From: "S. M. Halloran" <mitch AT duzen DOT com DOT tr>
Organization: User RFC 822- and 1123-compliant
To: djgpp AT delorie DOT com
Date: Wed, 15 Sep 1999 11:48:24 +0200
MIME-Version: 1.0
Subject: Re: more on variables - what includes
In-reply-to: <000901bf0096$cff07540$44f243c3@marocky>
X-mailer: Pegasus Mail for Win32 (v3.12)
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019