Advertising banner:
 
 
 A329
 
81203_43854_21.png 81203_43840_19.png


Method
Definition
Syntax
Example
CloseFile
Closes a server file that has been opened with the OpenFile method.
81203_42521_14.png        Note
If a variable is declared globally, the file closes when the program ends. If a variable is declared locally, the file closes when the program exits that subroutine.
serverfilevariable.CloseFile
See the example for the Openfile method.
EOF
Returns the current status of the end of file (EOF) flag on the server. The EOF flag indicates whether the file has read up to, or beyond, the end of the file.
serverfilevariable.EOF
See the example for the Read file method.
OpenFile
Opens, creates, or sends a server file for reading, writing, and/or downloading.
serverfilevariable.OpenFile(path,openconst)
The path specifies a path to a file on the server that is to be opened. The openconst argument specifies how the file should be opened and can consist of the following values:
       fc.Read - opens a file for reading; otherwise displays an error
       fc.Write - opens a file for writing; otherwise displays an error
       fcAppend - opens a file for appending without removing the EOF marker before writing new data.
A new file is created if one does not exist.
       fcUpdate - opens a file for both reading and writing; otherwise displays an error
       fcReadWrite - opens an empty file for both reading and writing.
If the file exists, the contents are deleted. Otherwise, the file is created.
MyFile.OpenFile ("C:\TEST.TXT", fcWrite)
MyFile.OpenFile ("C:\TEST.TXT", fcRead)
Position
Moves the server file cursor used for reading and writing.
serverfilevariable.Position(origin[,offset])
The Position method moves the position of the cursor in a file in the server's file system. The origin argument indicates the starting point, and the offset argument indicates the number of bytes to move from that location (+ value indicates a move forward; - value indicates a move backwards). The origin argument must be one of the following:
       fcBegin - file cursor origin at the beginning of file
       fcEnd - file cursor origin at the end of file
       fcCurr - file cursor origin at the current position (unchanged).
MyFile.Position (fcBegin) 'position cursor at beginning of file'
MyFile.Position (fcEnd, -10) 'position cursor 10 characters back from end of file'
Read
Attempts a binary read of bytes from a server file.
serverfilevariable.Read(numbytes)
The read data is stored in the Data attribute of the File object. If the end of file is reached before numbytes bytes are read, the Read method stores the maximum number of bytes.
MyFile.Read(100)
Print MyFile.Data
ReadLine
Reads from an open text server file until the end of the current line and returns the result as a string. This makes text parsing much easier and allows for faster reading of text-based data into FCAS variables.
serverReadLine (MaximumBytesToBeRead)
Dim MyFile as File
        MyFile.OpenFile ("c:\autoexec.bat", fcRead)
                print "The first line of your autoexec.bat file is:" &
        MyFile.ReadLine(1024)
        MyFile.CloseFile
Write
Writes binary or text data to a server file.
If the file has not been opened for writing with the OpenFile method, Write will display an error.
serverfilevariable.Write(filedata)
MyFile.Write  'This string is written into the file


hirosue Shino Web Site