Argox PA-20 Programming Guide Instrukcja Użytkownika Strona 45

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 130
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 44
PT-20 Programming Guide
43
and an error code is set to the global variable
fErrorCode to indicate the error condition encountered. Possible
error codes and their interpretation are listed below.
fErrorCode
1:filename is a NULL string.
6:Can't create file. Because the maximum number of files allowed in the
system is exceeded.
read
Purpose
Read a specified number of bytes from a DAT file.
Syntax
int read(int fd, char *buffer, unsigned count);
Example call
if ((bytes_read = read(fd,buffer,50)) = = -1)
_puts(“read error!”);
Includes
#include “SDK.h ”
Description
The read function copies the number of bytes specified in the
argument count from the DAT file whose file handle is fd to the
array of characters buffer. Reading starts at the current position of
the file pointer, which is incremented accordingly when the
operation is completed.
Returns
The read function returns the number of bytes actually read from
the file. In case of error, read returns an integer value of -1 and an
error code is set to the global variable fErrorCode to indicate the
error condition encountered. Possible error codes and their
interpretation are listed below.
fErrorCode
2:File handle is NULL.
7:fd is not a file handle of a previously opened file.
read_error_code
Purpose
Get the value of the global variable fErrorCode.
Syntax
int read_error_code( );
Example call
if (read_error_code( ) = = 2) _puts(“File not exist!”);
Includes
#include “SDK.h ”
Description
The read_error_code function gets the value of the global variable
fErrorCode and returns the value to the calling program. The
programmer can use this function to get the error code of the file
manipulation routine previously called. However, the global
variable fErrorCode can be directly accessed without making a
call to this function.
Returns
The read_error_code function returns the value of the global
variable fErrorCode.
fErrorCode
None
Przeglądanie stron 44
1 2 ... 40 41 42 43 44 45 46 47 48 49 50 ... 129 130

Komentarze do niniejszej Instrukcji

Brak uwag