fileOpen

C Styled Script
Reference Manual

<< Back  End  Next >>
 
 
INDEX
Introduction
Installation
Using The CSS Executive
Language
Directives
System Library
String 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
C API
C++ API
CSS 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 Trunc 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 tofileRead, fileWrite, fileClose etc.

Examples:

// open a file in textmode 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 LandquartLast revised by Peter Koch, 24.02.00<< Back  Top  Next >>