SP File Functions

 STRIP_PATH()   Strip path and optionally extension from a filespec
 ISVALFILE()    Checks a file name for validity
 FMOVE2PRIOR()  Moves to beginning of previous CRLF delimited line in
                a text file
 FMOVE2NEXT()   Move to beginning of next line in a text file
 FILEINFO()     Returns file date,time,size
 NKEY()         Gets key of an index file
 SFREADLINE()   Reads in text up to the next CRLF in a text file
 WRITEFILE()    Writes a line or lines  to a text file

 

SP_WRITEFILE

WRITEFILE()

  Short:
  ------
  WRITEFILE() Writes a line or lines  to a text file

  Returns:
  --------
  nothing

  Syntax:
  -------
  Writefile(cFileName|n|FileHandle,cText|aText)

  Description:
  ------------
  Writes line(s) of text with CR LF to a file
  referenced either as a file handle <nFileHandle> or a file
  name <cFileName>.

  Writes either a single line contained in <cText> or all of the
  contents of array <aText> to the file.

  Examples:
  ---------
   1. WRITEFILE('ERROR.TXT','THERE WAS AN ERROR')

   2. aErrors := array(3)
      aErrors[1] = 'There was an error'
      aErrors[2] = 'Error # 61765  '
      aErrors[3] = dtoc(date)
      writefile('ERROR.TXT',aErrors)

   3. nHandle := fopen("error.txt",1)
      aErrors := array(3)
      aErrors[1] = 'There was an error'
      aErrors[2] = 'Error # 61765  '
      aErrors[3] = dtoc(date)
      writefile(nHandle,aErrors)

  Notes:
  -------
  If a filename is passed, the file is opened and
  closed by the function.

  If a file handle is passed, the file is left open. If
  the file does not exist, it is created.

  PREVIOUSLY AN ARRAY NAME WAS PASSED. THIS MUST NOW BE
  AN ARRAY.

  Source:
  -------
  S_WRITEF.PRG