Bookshelf Home | Contents | Index | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > File I/O Methods in eScript > Clib.fread() MethodThis method reads data from an open file and stores it in a variable. Syntax AClib.fread(destBuffer, bytelength, filePointer) Syntax BClib.fread(destVar, varDescription, filePointer) Syntax CClib.fread(blobVar, blobDescriptor, filePointer) ReturnsThe number of elements read. For destBuffer, the number of bytes read, up to bytelength. For varDescription, 1 if the data is read, or 0 if there is a read error or EOF is encountered. UsageThis method reads data from the open file filePointer and stores it in the specified variable. If it does not yet exist, the variable, buffer, or BLOB is created. The varDescription value is a variable that describes how and how much data is to be read: if destVar is to hold a single datum, then varDescription must be one of the following: For example, the definition of a structure might be: ClientDef = new blobDescriptor(); The Siebel eScript version of fread() differs from the standard C version in that the standard C library is set up for reading arrays of numeric values or structures into consecutive bytes in memory. In JavaScript, this is not necessarily the case. Data types are read from the file in a byte-order described by the current value of the BigEndianMode global variable. ExampleTo read the 16-bit integer if ( !Clib.fread(i, SWORD16, fp) || !Clib.fread(f, FLOAT32, fp) See Also |
Siebel eScript Language Reference |