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

 Syntax
   proc fbwriteln extern
   param value _HFILE hFile, ;
         const char   cText

 Arguments
   hFile is the handle of the file to manipulate.
   cText is the string to write to the file.

 Return
   None.

 Description
   The fbwriteln() function writes the line of text stored in cText to the
   file represented by the hFile parameter.

 Example
   #define EXAMPLE_FILE
   #include example.hdr

   proc Test_fbwriteln
   vardef
      _HFILE     hFile
      char( 20 ) cBuffer
      uint       nLine
   enddef
   cBuffer := space( 20 )
   nLine := 0
   if fbopen( hFile, "test.txt", FB_CWRITE )               // open file
      ? "Type some lines, finish with empty line"; ?
      repeat
         nLine++
         input "Line " + istr( nLine ) + ": " to cBuffer   // get a line
         fbwriteln( hFile, cBuffer )                       // write line
      until isempty( cBuffer )
      fbclose( hFile )                                     // close file
      ? ; ? "File contents"; ?
      type "test.txt"                                      // display file
      ? ; wait
      erase "test.txt"                                     // clean up
   endif
   endproc

   proc main
   Test_fbwriteln()
   endproc

See Also: fbwrite()

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