Metrologic Optimus S Programming Manual page 200

"c" programming guide
Table of Contents

Advertisement

194
"C" Programming Guide For Optimus S/R
open
Error Code
2
4
7
8
9
15
See Also
tell
Purpose
To open a DAT file and get its file handle for further processing.
int open (char *filename);
Syntax
char *filename;
Example
if (fd = open ("data1" > 0) puts ("data 1 is opened!\n");
Description
This routine opens a DAT file (filename) and gets the file handle of it.
A file handle is a positive integer (greater than zero) used to identify the
file for subsequent file manipulation on the file.
If the file specified by filename does not exist, it will be created first.
If filename exceeds eight characters, it will be truncated to eight
characters.
After the file is opened, the file pointer points to the beginning of file.
Return
If successful, it returns the file handle.
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
1
4
5
6
close
See Also
Interpretation
File specified by fd does not exist.
File specified by fd is not a DAT file.
Invalid file handle.
File not opened.
Invalid value in argument: origin
New position is beyond end-of-file.
Interpretation
filename is a NULL string.
File specified by filename is not a DAT file.
File specified by filename is already opened.
Cannot create file. Because it is beyond the
maximum number of files allowed in the
system.
/* name of the file to be opened */

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents