Chapter 3 Terminal Specific Function Library
189
9
The value of
count
is negative.
10
No free file space for file extension.
See Also
appendln, read, readln, write, writeln
appendln
Purpose
To write a line (null-terminated string) to the bottom (EOF) of a DAT file.
Syntax
int appendln (int fd, char *buffer);
int fd; /* file handle of the target DAT file */
char *buffer; /* pointer to a buffer where data is written to */
Example
appendln (fd, data_buffer);
Description
This routine writes a null-terminated string from the character array
buffer
to
the bottom of a DAT file (
fd
).
Characters are written to the file until a null character (\0) is encountered.
The null character is also written to the file.
Writing of data starts at the end-of-file position, and the file pointer
position is unaffected by the operation.
This routine will automatically extend the file size to hold the data written.
Return
If successful, it returns the number of bytes actually written to the file,
including the null character.
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.
10
No free file space for file extension.
11
Cannot find string terminator in
buffer
.
See Also
append, read, readln, write, writeln
chsize
Purpose
To extend or truncate a DAT file.
Syntax
int chsize (int fd, long size);
Summary of Contents for Optimus R
Page 1: ...Printed on 20 March 2006 C Programming Guide Version 3 04 02 Optimus S Optimus R...
Page 6: ......
Page 8: ...2 C Programming Guide For Optimus S R...
Page 12: ...6 C Programming Guide For Optimus S R The flow is illustrated as shown below...
Page 23: ...Chapter 2 Development Environment 17 Different types signed unsigned Different types same size...
Page 24: ...18 C Programming Guide For Optimus S R...
Page 220: ...214 C Programming Guide For Optimus S R See Also FlashSize free_memory...