Does any know fo a routine that will load all of files characters into an array?
Yes: Code: #include <iostream> #include <fstream> #include <sys/types.h> #include <sys/stat.h> using namespace std; void reader() { struct _stat buf; _stat("file.ext", &buf); long lLen = buf.st_size; char *pcBuf = new char[lLen+1]; ifstream inFile("file.ext"); if(inFile.good()) { inFile.read(pcBuf, lLen); } pcBuf[lLen] = 0; // Null-terminate, just in case // Use array delete[] pcBuf; }
#include <iostream> #include <fstream> #include <sys/types.h> #include <sys/stat.h> using namespace std; void reader() { struct _stat buf; _stat("file.ext", &buf); long lLen = buf.st_size; char *pcBuf = new char[lLen+1]; ifstream inFile("file.ext"); if(inFile.good()) { inFile.read(pcBuf, lLen); } pcBuf[lLen] = 0; // Null-terminate, just in case // Use array delete[] pcBuf; }
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You". -- Linus Torvalds
Forum Rules