186
"C" Programming Guide For Optimus S/R
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
1
filename
is a NULL string.
filelist
Purpose
To get the file directory information.
Syntax
int filelist (char *dir);
char *dir; /* pointer to a buffer where the information is copied to */
Example
total_file = filelist (dir);
Description
This routine copies the file name, file type, and file size information (separated
by a blank character) of all files in existence into a character array specified by
the argument
dir
.
Return
It simply returns the number of files currently exist in the system.
read_error_code
Purpose
To get the value of the global variable fErrorCode.
Syntax
int read_error_code (void);
Example
if (read_error_code() == 2) puts ("File not exist!\n");
Description
This routine gets the value of the global variable fErrorCode and returns the
value to the calling program. User can call this function to get the error code of
the previously called routine for file manipulation.
Yet, the global variable fErrorCode can be directly accessed without making a
call to this routine.
Return
It returns the value of the global variable fErrorCode.
remove
Purpose
To delete a file.
Syntax
int remove (char *filename);
char *filename; /* name of the file to be deleted */
Example
if (remove ("data1")) puts ("data1 is deleted!\n");
Description
This routine deletes the file specified by the argument
filename
.
If the
filename
exceeds eight characters, it will be truncated to eight
characters.
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...