Argox PA-20 Programming Guide Manuel d'utilisateur Page 54

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 130
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 53
PT-20 Programming Guide
52
w+
Creates a file and opens it for both reading and writing.
If file exists, current contents are destroyed.
Returns
If the file is opened successfully, _fopen returns a pointer to the file. Actually,
this is a pointer to a structure of type _TFILE, which is defined in the header
file. The actual structure is allocated elsewhere and you do not have to
allocate it. In case of an error, _fopen returns a NULL.
_fread
Purpose
Use _fread to read a specified number of data items, eachof a given size,
from the current position in a file opened for buffered input. The current
position is updated after the read.
Syntax
size_t _fread(const void *buffer, size_t size, size_t count, _TFILE
*file_pointer);
Example call
Numread = _fread(buffer, sizeof(char), 80, infile);
Includes
#include “SDK.h”
Description
The fread function reads count data items, each of size bytes, starting at the
current read position of the file specified by the argument file_pointer. After
the read is complete, the current position is updated. You must allocate
storage for a buffer to hold the number of bytes that you expect to read. This
buffer is a pointer to a void data type.
Returns
The _fread function returns the number of items it successfully read.
_fseek
Purpose
Use _fseek to move to a new position in a file opened for buffered
input/output.
Syntax
int _fseek(_TFILE *file_pointer, long offset, int origin);
Example call
_fseek(infile, 0, SEEK_SET); /* Go to the beginning */
Includes
#include “SDK.h”
Description
The fseek function sets the current read or write position of the file specified
by the argument file_pointer to a new value indicated by the arguments
“off-set” and “origin”. The
“offset” is a long integer indicating how far away the new position is from a
specific location given in “origin”. The following table explains the possible
value of “origin”.
Origin
Interpretation
SEEK_SET
SEEK_CUR
Beginning of file.
Current position in the file.
Returns
When successful, _fread returns a zero. In case of error, _fread returns a
Vue de la page 53
1 2 ... 49 50 51 52 53 54 55 56 57 58 59 ... 129 130

Commentaires sur ces manuels

Pas de commentaire