![Advantech UbiQ Скачать руководство пользователя страница 81](http://html1.mh-extra.com/html/advantech/ubiq/ubiq_user-manual_2856809081.webp)
75
UbiQ Scenario Manager User Manual
Chapter 5
Functions
Reference
5.2.21
read
Syntax
int read(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 read, which may be less than nCount
if there are fewer than count bytes left in the file. If the function tries to read at
end of file, it returns 0. If the handle is invalid, or the file is not open for reading,
or the file is locked, the function returns -1.
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
nLen=read(hFile, data, 512);
while (nLen!=512) {
nLen=read(hFile,data,512);
}
close(hFile); // close the file
}
See Also
open, close, write, seek, readln, writeln, filecopy, eof
Содержание UbiQ
Страница 1: ...User Manual UbiQ Scenario Manager User Manual V1 03...
Страница 4: ...UbiQ Scenario Manager User Manual iv...
Страница 7: ...Chapter 1 1 Introduction...
Страница 13: ...Chapter 2 2 Getting Started...
Страница 37: ...Chapter 3 3 Tutorials...
Страница 47: ...Chapter 4 4 Basic of Smart C Script Language...
Страница 62: ...UbiQ Scenario Manager User Manual 56...
Страница 63: ...Chapter 5 5 Functions Reference...