PT-20 Programming Guide
51
_fcloseAll
Purpose
:
Use _fcloseAll to close all files opened for buffered input/output with _fopen
or tmpfile.
Syntax
:
void _fcloseAll(void);
Example call
:
_fcloseAll();
Includes
:
#include “SDK.h”
Description
:
The _fcloseAll function closes all files that have been opened by _fopen or
tmpfile for buffered I/O. Buffers associated with files opened for writing are
written out to the corresponding file before closing.
_filelength
Purpose
:
Use _filelength to dertimine the length of a file in bytes.
Syntax
:
size_t _filelength(_TFILE* file_pointer);
Example call
:
file_size = _filelength(infile);
Includes
:
#include “SDK.h”
Description
:
The _filelength function returns the size in number of bytes of the file
specified in the argument file_pointer. This pointer should be the return
value of earlier opened file by _fopen.
Returns
:
The integer value returned by _filelength is the size of the file in 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 “SDK.h”
Description
:
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.