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 - fputc() write a single character to a buffered file stream http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 fputc()             Write a single character to a buffered file stream
------------------------------------------------------------------------------
 Declaration
   fileio.hdr

 Syntax
   proc fputc extern
   param       file fStream, ;
         value int  iValue

 Arguments
   fStream is the file stream to manipulate.
   iValue is the character to write to the file.

 Return
   None.

 Description
   fputc() writes a single byte character to the previously opened buffered
   file stream. Any character is allowed, except -1 which is internally
   reserved for the symbolic EOF.

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   #pragma ESCSEQ+
   
   proc Test_fputc
   vardef
      file fTemp
   enddef
   fopen( fTemp, "test.txt", F_CREATE, F_TEXT ) // open file
   fput( fTemp, "Line " )              // these become one line
   fput( fTemp, "1" )
   fputc( fTemp, 13 )                  // manually add CRLF
   fputc( fTemp, 10 )
   fput( fTemp, "Line 2" )
   fput( fTemp, "\r\n" )               // add CRLF in string literal
   fput( fTemp, "Line 3\r\n" )
   fwriteln( fTemp, "Line 4" )         // CRLF appended at end of line
   fputln( fTemp, "Line 6" )           // CRLF prepended to line
   fclose( fTemp )                     // close file
   type "test.txt"                     // display file
   erase "test.txt"                    // clean up
   endproc

   proc main
   Test_fputc()
   endproc

See Also: fgetc() fput() fputln() fwriteln()

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