196
"C" Programming Guide For Optimus S/R
If characters are read until a null character (\0) is encountered. The null
character is also read into
buffer
, that is, it is also counted for the return
value. Otherwise, there may not be a null character stored in
buffer
.
Reading of data starts at the current position of the file pointer, which is
incremented accordingly when the operation is completed.
The argument
max_count
is usually set to a value which equals the size of
the character array
buffer
to avoid string overflow.
Return
If successful, it returns the number of bytes actually read from the file.
On error, it returns -1.
An error code is set to the global variable fErrorCode to indicate the error
condition encountered. Below are possible error codes and their interpretation.
Error Code
Interpretation
2
File specified by
fd
does not exist.
4
File specified by
fd
is not a DAT file.
7
Invalid file handle.
8
File not opened.
9
The value of
max_count
is negative.
See Also
read, write, writeln
tell
Purpose
To get the current file pointer position of a DAT file.
Syntax
long tell (int fd);
int fd; /* file handle of the target DAT file */
Example
current_position = tell (fd);
Description
This routine gets the current file pointer position of a DAT file (
fd
).
The file pointer position is expressed in number of bytes from the
beginning of file. For example, if the file pointer points to the beginning of
file, its position will be 0L.
Return
If successful, it returns the number of bytes for the current file pointer.
On error, it returns -1L.
An error code is set to the global variable fErrorCode to indicate the error
condition encountered. Below are possible error codes and their interpretation.
Error Code
Interpretation
2
File specified by
fd
does not exist.
4
File specified by
fd
is not a DAT file.
7
Invalid file handle.
18
File not opened.
Содержание Optimus R
Страница 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Страница 6: ......
Страница 8: ...2 C Programming Guide For Optimus S R...
Страница 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Страница 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Страница 24: ...18 C Programming Guide For Optimus S R...
Страница 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...
Страница 232: ...226 C Programming Guide For Optimus S R 4 11 Implementation defined Limits limits h float h Refer to limit h and float h...
Страница 238: ...232 C Programming Guide For Optimus S R...