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 - fwriteln() write text line followed by cr/lf to file stream http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 fwriteln()          Write text line followed by CR/LF to file stream
------------------------------------------------------------------------------
 Declaration
   fileio.hdr

 Syntax
   proc fwriteln 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 fwriteln() function writes a line of text to the file stream. It works
   similar to fputln(), but places the CR/LF after the text line, i.e. it is
   equivalent to

   fput( fStream, cLine )
   fputln( fStream, "" )

   and similar to

   ??? cLine

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   proc FileCopy
   para const char( 128 ) cFileIn, const char( 128 ) cFileOut
   // Copy a text file
   vardef
      file fIn
      file fOut
      char cBuffer
   enddef
   fopen( fIn, cFileIn, F_READ, F_TEXT )     // open input file
   fopen( fOut, cFileOut, F_CREATE, F_TEXT ) // open output file
   do while .not. feof( fIn )                // copy loop
      fgetln( fIn, cBuffer )                 // get a line
      fwriteln( fOut, cBuffer )              // output the line
   enddo
   fclose( fIn )                             // close input file
   fclose( fOut )                            // close output file
   endproc
   
   proc Test_fwriteln
   if exist( argv( 1 ) )
      FileCopy( argv( 1 ), "copied" )
   else
      ? "Usage: fcopy <name of file to copy>"
      ? "The copied file will be called 'copied'"
   endif
   endproc

   proc main
   Test_fwriteln()
   endproc

See Also: fgetln() fput() fputc() fputln()

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