Flash Media Server |
|||
| Server-Side ActionScript Language Reference > Server-Side ActionScript Language Reference > File class > File.read() | |||
Flash Media Server 2.
fileObject.read(numChars)
numChars An integer specifying the number of characters to read. If numChars specifies more bytes than are left in the file, the method reads to the end of the file.
A string.
Method; reads the specified number of characters from a file and returns a string. The operation will fail if the file is opened in binary mode.
The following code opens a text file in read mode and sets variables for the first 100 characters, a line, and a byte:
if (myFileObject.open( "text", "read") ){
strVal = myFileObject.read(100);
strLine = myFileObject.readln();
strChar = myFileObject.readByte();
}
File.readAll(), File.readByte(), File.readln()