Filewrite, Tablefile – Campbell Scientific CR9000X Measurement and Control System User Manual
Page 388

Section 9. Program Control Instructions
FileWrite
Writes ASCII or binary data to a file referenced in the program by a
FileHandle.
Syntax
BytesWritten = FileWrite(FileHandle, Source, Length)
Remarks
This function writes the data in the Source variable to a FileHandle created by
FileOpen. This function returns the number of bytes successfully written to the
file.
Parameter
& Data Type
Enter
FILEWRITE PARAMETERS
FileHandle
variable
Variable that holds the result of the FileOpen function.
Source
String Variable
String variable that holds the data that should be written to the file.
Length
Variable array
The maximum number of characters that should be written to the file. If Length is set to 0,
the string length of Source will be used.
TableFile
Creates a file from a datalogger's data table and writes the file to the
datalogger's CPU or a compact flash card. This instruction must be place
inside of a DataTable Construct.
Syntax
TableFile ( FileName, Options, MaxFiles, NumRecs/TimeIntoInterval,
Interval, Units, OutStat, LastFileName)
Remarks
The TableFile instruction must be placed inside a DataTable declaration for
the table you wish to write to file. The TableFile instruction writes a file based
on a specified number of records or on a time interval. The resulting file is
saved with a .dat extension, and can be saved as either TOA5 or binary.
If the TableFile instruction is writing to a compact flash card, and the program
uses the CardOut instruction as well, then prior to creating the fixed size
CardOut tables the required card space will be calculated and reserved for all
fixed size TableFile files. Space is reserved by subtracting the estimated space
required by the instruction from the available memory on the card (however,
space is not pre-allocated). If the TableFile instruction uses auto-allocation
then no space is reserved for its files and the MaxFiles value will be set once
the card is full. If both the TableFile and the CardOut instruction attempt to
use auto-allocation, a compile error will be returned. When a compact flash
card is removed, all TableFiles will be written to the card, regardless of
whether the output condition (time interval or fixed number of records) has
been met.
Note that these files cannot be acted upon using the data table access
functions.
9-58