fileOpen

C Scripting Language
Reference Manual
Version 4.4.0

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using the CSL executive
Language
Directives
System library
String library
Math library
Regular expression lib.
File library
   fileClose
   fileCopy
   fileDelete
   fileDelDir
   fileEof
   fileFlush
   fileInfo
   fileLocate
   fileMakeDir
   fileOpen
   fileRead
   fileReadLine
   fileReadPos
   fileRename
   fileTempName
   fileWrite
   fileWriteLine
   fileWritePos
Database library
Async Communication
Registry/Profile handling
Windows control
C API
C++ Class Interface
CSL links
  
fileOpen(
  const filename,  // name of file
  const mode)      // open mode

Opens a file for reading/writing. Mode is the sum of any of the following constants:

Constant Description
fileOpenRead Open file for reading
fileOpenWrite Open file for writing
fileOpenAppend Open and set write position to EOF
fileOpenTrunc Truncate file if opened file existed before
fileOpenOld The file ought to exist (don't combine this with fileOpenNew).
fileOpenNew The file must not exist (don't combine this with fileOpenOld)
fileOpenBinary Open in binary mode. By default files are opened in text mode where EOL is represented by a LF only. In Binary mode EOL may also be represented as CR LF, depending on the operating system.

Returns a file handle that must be used in subsequent calls to fileRead, fileWrite, fileClose etc.

Examples:

// open a file in text mode to append text
var fh = fileOpen('logfile.log',
                  fileOpenWrite+fileOpenAppend);
 
// open a file in binary mode for random access
var fh = fileOpen('address.dbf',
                  fileOpenRead+
                  fileOpenWrite+
                  fileOpenBinary);
  Copyright © IBK Landquart Last revision: 27.05.2002 << Back  Top  Next >>