![Advantech UbiQ User Manual Download Page 82](http://html1.mh-extra.com/html/advantech/ubiq/ubiq_user-manual_2856809082.webp)
UbiQ Scenario Manager User Manual
76
5.2.22
readln
Syntax
int readln(int hFile,char *buf)
Parameters
hFile: Specifies the handle referring to open file
buf: Specifies the storage location for data
Description
This function returns the number of bytes read. This function reads a line of text
and then skips to the next line of the file. The file must be a text file, in which
case each carriage return®Clinefeed (CR-LF) pair or single linefeed character
is replaced with a Null-ended character. 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_READ);
setdebug(TRUE);
if (hFile==0) {
debug(“Open file failed!”);
}
else {
// process the file
readln(hFile, data);
while (!eof(hFile)) {
readln(hFile,data);
}
close(hFile); // close the file
}
See Also
open, close, read, write, seek, 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...