190
"C" Programming Guide For Optimus S/R
int fd; /* file handle of the target DAT file */
long size; /* new size of file in bytes */
Example
if (chsize (fd, 0L)) puts ("file is truncated!\n");
Description
This routine extends or truncates a DAT file (
fd
) to match the new file length in
bytes given in the argument
size
.
If the file is truncated, all data beyond the new file size will be lost.
If the file is extended, no initial value is filled to the newly extended area.
Return
If successful, it returns 1.
On error, it returns 0.
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.
close
Purpose
To close a DAT file.
Syntax
int close (int fd);
int fd; /* file handle of the target DAT file */
Example
if (close (fd)) puts ("file is closed!\n");
Description
This routine closes a previously opened or created DAT file (
fd
).
Return
If successful, it returns 1.
On error, it returns 0.
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.
See Also
open
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...