Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > The Clib Object >
Clib.fwrite() Method
This method writes the data in a specified variable to a specified file and returns the number of elements written.
Syntax A
Clib.fwrite(sourceVar, varDescription, filePointer)
Syntax B
Clib.fwrite(sourceVar, bytelength, filePointer)
Returns
0 if a write error occurs; use Clib.ferror() to get more information about the error.
Usage
This method writes the data in sourceVar to the file indicated by filePointer and returns the number of elements written.
The varDescription variable describes how much data is to be read from the object indicated by sourceVar:
If sourceVar Is Value of varDescription Is Buffer Length of the buffer Object Object descriptor A single datum One of the values listed in Clib.fread() MethodThe Siebel eScript version of fwrite() differs from the standard C version in that the standard C library is set up for writing arrays of numeric values or structures from consecutive bytes in memory. This is not necessarily the case in eScript.
Example
To write the 16-bit integer
i
, the 32-bit floatf
, and the 10-byte bufferbuf
into open filefp
, use the following code:if ( !Clib.fwrite(i, SWORD16, fp) || !Clib.fwrite(f, FLOAT32, fp)
|| 10 != fwrite(buf, 10, fp))
{
TheApplication().RaiseErrorText("Error writing to file.\n");
}See Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |