Given:
const string inputFile = \"C:\\MyFile.csv\";
char buffer[10000];
How do I read the chars of the file in to the above buffer? I have
If you're concerned with efficiency (you rejected getline()) then a C-style mmap is probably best:
#include
#include
struct stat s;
stat(inputFile.c_str(), &s);
size_t file_size = st.st_size;
int fhand = open(inputFile);
char* file_buf = (char*)mmap(0, file_size, PROT_READ, MAP_FILE|MAP_PRIVATE, fhand, 0);
...
munmap(file_buf, file_size);