XBinder
Version 2.6.x
|
Common runtime functions for reading from or writing to files. More...
#include "rtxsrc/rtxContext.h"
Go to the source code of this file.
Functions | |
EXTERNRT OSBOOL | rtxFileExists (const char *filePath) |
This function tests if a file exists. More... | |
EXTERNRT OSBOOL | rtxFileIsDirectory (const char *filePath) |
This function tests if a file is actually a directory. More... | |
EXTERNRT time_t | rtxFileLastModified (const char *filePath) |
This function returns the last modified time for a given file. More... | |
EXTERNRT int | rtxFileOpen (FILE **ppFile, const char *filePath, const char *access) |
This function opens a file for read, write, or append access. More... | |
EXTERNRT int | rtxFileReadBinary (OSCTXT *pctxt, const char *filePath, OSOCTET **ppMsgBuf, size_t *pLength) |
This function reads the entire contents of a binary file into memory. More... | |
EXTERNRT int | rtxFileReadBinary2 (OSCTXT *pctxt, FILE *pFile, OSOCTET **ppMsgBuf, size_t *pLength) |
This function reads the entire contents of a binary file into memory. More... | |
EXTERNRT int | rtxFileReadBinToSysMem (OSCTXT *pctxt, const char *filePath, OSOCTET **ppMsgBuf, size_t *pLength) |
This function reads the entire contents of a binary file into memory. More... | |
EXTERNRT int | rtxFileReadText (OSCTXT *pctxt, const char *filePath, OSOCTET **ppMsgBuf, size_t *pLength) |
This function reads the entire contents of an ASCII text file into memory. More... | |
EXTERNRT int | rtxFileWriteBinary (const char *filePath, const OSOCTET *pMsgBuf, size_t length) |
This function writes binary data from memory to the given file. More... | |
EXTERNRT int | rtxFileWriteText (const char *filePath, const char *pMsgBuf) |
This function writes text data from memory to the given file. More... | |
EXTERNRT int | rtxFileCopyTextFile (const char *srcFilePath, const char *destFilePath) |
This function copies the contents on one text file to another. More... | |
Common runtime functions for reading from or writing to files.
Definition in file rtxFile.h.
EXTERNRT int rtxFileCopyTextFile | ( | const char * | srcFilePath, |
const char * | destFilePath | ||
) |
This function copies the contents on one text file to another.
srcFilePath | Complete file path name of file to be copied. |
destFilePath | Complete file path name of target file. |
EXTERNRT OSBOOL rtxFileExists | ( | const char * | filePath | ) |
This function tests if a file exists.
filePath | Complete file path name of file to be tested. |
EXTERNRT OSBOOL rtxFileIsDirectory | ( | const char * | filePath | ) |
This function tests if a file is actually a directory.
filePath | Complete path name of file to be tested. |
EXTERNRT time_t rtxFileLastModified | ( | const char * | filePath | ) |
This function returns the last modified time for a given file.
If the file does not exist or some error occurs, 0 is returned.
EXTERNRT int rtxFileOpen | ( | FILE ** | ppFile, |
const char * | filePath, | ||
const char * | access | ||
) |
This function opens a file for read, write, or append access.
It is basically a wrapper for the C run-time fopen function except in the case of Visual Studio, the more secure fopen_s function is used.
ppFile | Pointer to FILE variable to receive file pointer. |
filePath | Complete file path name of file to be opened. |
access | File access string as defined for C fopen. |
EXTERNRT int rtxFileReadBinary | ( | OSCTXT * | pctxt, |
const char * | filePath, | ||
OSOCTET ** | ppMsgBuf, | ||
size_t * | pLength | ||
) |
This function reads the entire contents of a binary file into memory.
A memory buffer is allocated for the file contents using the run-time memory management functions.
pctxt | Pointer to context block structure. |
filePath | Complete file path name of file to read. |
ppMsgBuf | Pointer to message buffer to receive allocated memory pointer. |
pLength | Pointer to integer to receive length of data read. |
EXTERNRT int rtxFileReadBinary2 | ( | OSCTXT * | pctxt, |
FILE * | pFile, | ||
OSOCTET ** | ppMsgBuf, | ||
size_t * | pLength | ||
) |
This function reads the entire contents of a binary file into memory.
A memory buffer is allocated for the file contents using the run-time memory management functions.
pctxt | Pointer to context block structure. |
pFile | Pointer to the open file. |
ppMsgBuf | Pointer to message buffer to receive allocated memory pointer. |
pLength | Pointer to integer to receive length of data read. |
EXTERNRT int rtxFileReadBinToSysMem | ( | OSCTXT * | pctxt, |
const char * | filePath, | ||
OSOCTET ** | ppMsgBuf, | ||
size_t * | pLength | ||
) |
This function reads the entire contents of a binary file into memory.
A memory buffer is allocated for the file contents using the standard configured system memory allocation function (usually malloc).
pctxt | Pointer to context block structure. |
filePath | Complete file path name of file to read. |
ppMsgBuf | Pointer to message buffer to receive allocated memory pointer. |
pLength | Pointer to integer to receive length of data read. |
EXTERNRT int rtxFileReadText | ( | OSCTXT * | pctxt, |
const char * | filePath, | ||
OSOCTET ** | ppMsgBuf, | ||
size_t * | pLength | ||
) |
This function reads the entire contents of an ASCII text file into memory.
A memory buffer is allocated for the file contents using the run-time memory management functions. This function is identical to rtxReadFileBinary except that a) the file is opened in text mode, and b) and extra byte is allocated at the end for a null-terminator character.
pctxt | Pointer to context block structure. |
filePath | Complete file path name of file to read. |
ppMsgBuf | Pointer to message buffer to receive allocated memory pointer. |
pLength | Pointer to integer to receive length of data read. |
EXTERNRT int rtxFileWriteBinary | ( | const char * | filePath, |
const OSOCTET * | pMsgBuf, | ||
size_t | length | ||
) |
This function writes binary data from memory to the given file.
filePath | Complete file path name of file to be written to. |
pMsgBuf | Pointer to buffer containing data to be written. |
length | Size (in bytes) of data to be written |
EXTERNRT int rtxFileWriteText | ( | const char * | filePath, |
const char * | pMsgBuf | ||
) |
This function writes text data from memory to the given file.
The text is expected to be terminated by a null terminator character. This function will work with standard ASCII or UTF-8 encoded text.
filePath | Complete file path name of file to be written to. |
pMsgBuf | Pointer to buffer containing data to be written. |