Message-Id: <3.0.16.19971029005847.1b9701d4@hem1.passagen.se> Date: Wed, 29 Oct 1997 01:01:31 -0500 To: saf AT club-internet DOT fr From: Peter Palotas Subject: Re: fputs(); HELP !!! SOS Cc: djgpp AT delorie DOT com Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Precedence: bulk At 12.40 1997-10-27 +0100, you wrote: >Hello the world ! > >I have a problem: >How can I write a numeric value to the disk ? >when I make: >.. >FILE *disk; >float i; > >... > > >fputs(i,disk); IT DOESNT WORK CORRECTLY >fclose(disk); > > >How can I write a numeric value to the disk ? Well, I don't know wether you want to store it as binary or text, i.e. if you want to be able to open the file in a text-editor and read the value, or if you just want to store it into the file as a binary number, which would probably be the case if you only wanted to read it into your program again. Anyway, if you want to write it as text you could use several methods, for an example: fprintf(disk, "%g", i); But if you want to store it as binary (make sure the file is opened in binary mode) you would use: fwrite(&i, sizeof(i), 1, disk); I hope this helps. -- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se -- ***************************************************** * A brief description of DJGPP: * * NEVER BEFORE HAS SO FEW DONE SO MUCH FOR SO MANY! * *****************************************************