
31
number of bytes.
_fopen
Purpose
:
Use
_fopen
to open a file for buffered input/output operations.
Syntax
:
_TFILE* _fopen(const char*filename, const char *access_mode);
Example call
:
input_file = _fopen("c:\\data\\order.dat", "r");
Includes
:
#include
“
UserLib.h
"
The
fopen
function opens the file specified in the argument
filename
.
The type of operations you intend to perform on the file must be
given in the argument
access_
mode. The following table explains the
values that the
access_mode
string can take:
Access
Mode String
Interpretation
r
Opens file for read operations only. The
_fopen
function fails if the file does not exist.
w
Opens a new file for writing. If the file exists, its
contents are destroyed.
r+
Opens an existing file for both read and write
operations. Error is returned if file does not exist.
Description
:
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.
_fopenLookup
Purpose
:
Use
_fopenLookup
to open an index file for buffered input/output
operations.
Syntax
:
char *_fopenLookup(char *pssFName, unsigned int* pulSize);
Example call
:
data_pointer = "D:\\Lookup\\MenuLook.dat", &unFileSize);
Includes
:
#include
“
UserLib.h
"
Description
:
The
_fopenLookup
function opens an index file in the path specified
by
pssFName
pointer. It returns a pointer to the first byte of the index
file continuous space block and writes the length of the continuous
space block to the location specified by the
pulSize
pointer. The
index file is a continuous space block, which the data was stored by
Содержание PT-10
Страница 4: ...3 Keyboard Wedge 99 System 101 Power 102 Other 102 ...
Страница 13: ...12 6 Development Flow Chart ...
Страница 53: ...52 Returns No returns Notes ...