UbiQ Scenario Manager User Manual
84
5.2.33
write
Syntax
int write(int hFile,char *buf, int nCount)
Parameters
hFile: Specifies the handle referring to open file
buf: Specifies the storage location for data
nCount: Specifies the maximum number of bytes
Description
This function returns the number of bytes actually written. If the actual space
remaining on the disk is less than the size of the buffer the function is trying to
write to the disk, write fails and does not flush any of the buffer’s contents to the
disk. A return value of -1 indicates an error.
Example
int hFile;
int nLen;
char data[512];
hFile=open(“\\flash storage\\template.txt”, FILE_CREATE_RW);
setdebug(TRUE);
if (hFile==0) {
debug(“Open file failed!”);
}
else {
// process the file
seek(hFile,SEEK_END,0);
data=”This is a test file”;
nLen=write(hFile, data, strlen(datta));
close(hFile); // close the file
}
See Also
open, close, read, seek, readln, writeln, filecopy, eof
Summary of Contents for UbiQ
Page 1: ...User Manual UbiQ Scenario Manager User Manual V1 03...
Page 4: ...UbiQ Scenario Manager User Manual iv...
Page 7: ...Chapter 1 1 Introduction...
Page 13: ...Chapter 2 2 Getting Started...
Page 37: ...Chapter 3 3 Tutorials...
Page 47: ...Chapter 4 4 Basic of Smart C Script Language...
Page 62: ...UbiQ Scenario Manager User Manual 56...