Equinox Online Help - Language Reference - A to Z

Home

FileDelimiters

Applies to
SyntaxFileDelimiters HandleItem, [, DelimiterExpression, QuoteExpression, EOL1Expression, EOL2Expression, EOFExpression]
Action[Statement] Defines the delimiters used within a sequential file.
ScopeUsable anywhere
Notes

This statement is used to define the various delimiters for both input and output operations. The HandleItem parameter must be of Equinox variable type Handle and is the handle of the file which was opened with the FileOpen statement.

DelimiterExpression specifies the character which separates each item within a sequential file. The default is a comma.

QuoteExpression is the character which is used to enclose a string. The default is a double quote character.

EOL1Expression and EOL2Expression determine the first and second end of line characters. They default to ASCII 13 (Return) and ASCII 10 (Linefeed) respectively.

EOFExpression specifies the value of the end of file character. The default is none.

All of the last five parameters are optional and are not changed if they are missing. Possible values include -1 which means read or write nothing, a character within quotes which is mapped literally or a number between 0 and 255 which is the ASCII value of the character. When reading data, the EOL1Expression character is ignored and the EOL2Expression character is used as the end of line.

The system workarea SysError is set to a non-zero value if an error occurs, otherwise zero.

CategoryFile IO
See Also FileClose, FileCloseAll, FileDelimiters, FileInput, FileInputLine, FileLock, FileMovePosition, FileOpen, FilePosition, FilePrint, FileRead, FileReadLine, FileReadBinary, FileReadFile, FileUnlock, FileWrite, FileWriteBinary, FileWriteFile
Example

The first example sets delimiters which are used typically in MSDOS files.

FileDelimiters hnd, ",","""", 13, 10, 26

The next example sets delimiters typically used in UNIX files. This represents ASCII 9 as the item delimiter, no characters denoting end of line and ASCII 10 as the end of file character.

FileDelimiters hnd, 9, -1, -1, 10

This example purely sets the end of file to 26 and uses the other default values. It assumes of course that no previous FileDelimiters statement has modified the defaults for that file.

FileDelimiters hnd, , , , 26

This example reads information from a UNIX format text file.

| Open the file and test for error
FileOpen "UNIXDATA.DAT", StreamReadOnly, hnd

if hnd = -1 then
Alert "File Opening Error"
Exit Method
end if

| Set delimiters
FileDelimiters hnd, 9, -1, -1, 10

| Read data from UNIX type file and write to print window
FileInput hnd, Surname, ChrName, Initials, TelNo
Print Surname, ChrName, Initials, TelNo
end while

FileClose hnd