Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - fput() write text to a buffered file stream http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 fput()              Write text to a buffered file stream
------------------------------------------------------------------------------
 Declaration
   fileio.hdr

 Syntax
   proc fput extern
   param       file fStream, ;
         const char cLine

 Arguments
   fStream is the file stream to manipulate.
   cLine is the string to write to the file.

 Return
   None.

 Description
   The fput() procedure writes cLine to the disk file associated with
   fStream. The file must have been opened in append or create mode.
   CR/LF characters are not prepended or appended to the string. Therefore,
   fput is similar to:

   ?? cLine

   Use fputln() instead to prepend the CR/LF characters to the output,
   similar to:

   ? cLine

   or use the fwriteln() procedure to append CR/LF characters, similar to

   ??? cLine

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   proc Test_fput
   vardef
      file fTemp
   enddef
   fopen( fTemp, "test.txt", F_CREATE, F_TEXT ) // open file
   
   fput( fTemp, "device=" )            // these become one line
   fput( fTemp, "c:\dos\himem.sys" )
   
   fputln( fTemp, "files=40" )         // each separate line
   fputln( fTemp, "stacks=9,256" )     // CRLF is in front of text
   
   fwriteln( fTemp, "" )               // write a CRLF
   fwriteln( fTemp, "buffers=8" )      // each separate line
   fwriteln( fTemp, "dos=high,umb" )   // CRLF is after text
   
   fclose( fTemp )                     // close file
   type "test.txt"                     // display file
   erase "test.txt"                    // clean up
   endproc

   proc main
   Test_fput()
   endproc

See Also: fputc() fputln() fwriteln()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson