Metrologic Optimus S Programming Manual page 203

"c" programming guide
Table of Contents

Advertisement

See Also
lseek
write
Purpose
To write a specified number of bytes to a DAT file.
Syntax
int write (int fd, char *buffer, int count);
int fd;
char *buffer;
int count;
Example
write (fd, data_buffer, 1024);
Description
This routine writes a number of bytes (count) from the character array buffer to
a DAT file (fd).
If successful, it returns the number of bytes actually written to the file.
Return
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
2
4
7
8
9
10
append, appendln, read, readln, writeln
See Also
writeln
To write a line (null-terminated string) to a DAT file.
Purpose
Syntax
int writeln (int fd, char *buffer);
int fd;
char *buffer;
Chapter 3 Terminal Specific Function Library
Writing of data starts at the current file pointer position, which is
incremented accordingly when the operation is completed.
If end-of-file is encountered during operation, this routine will
automatically extend the file size to hold the data written.
The maximum number of characters that can be written is 32767.
Interpretation
File specified by fd does not exist.
File specified by fd is not a DAT file.
Invalid file handle.
File not opened.
The value of count is negative.
No free file space for file extension.
/* file handle of the target DAT file */
/* pointer to a buffer where data is written to */
/* number of bytes to be written */
/* file handle of the target DAT file */
/* pointer to a buffer where data is written to */
197

Advertisement

Table of Contents
loading

This manual is also suitable for:

Optimus r

Table of Contents