You read them as binary files like any other file using for example the Windows API functions
CreateFile
/
ReadFile
or the C standard library
fopen
/
fread
functions. Before reading you have to determine the file size and allocate a buffer of that size plus one. The additional byte is for a trailing
NULL
byte to be appended after reading because both file types are plain text files.
Aftwerwards you can access the data as
char*
strings.
Note that opening in binary mode is required because only then the data are read as they are. Otherwise non-MS text files (LF only terminated lines) would be converted to CR - LF terminated lines making the allocarted buffer too small.
[EDIT]
Quote:
can i get a example code for that
#include <sys/stat.h>
struct stat st;
FILE *f = fopen("test.asc", "rb");
if (NULL != f)
{
fstat(_fileno(f), &st);
char *lpszFileData = new char[st.st_size + 1];
fread(lpszFileData, 1, st.st_size, f);
fclose(f);
lpszFileData[st.st_size] = 0;
delete[] lpszFileData;
}
[/EDIT]