hello all, I'm trying to input a file into an array, everything works, except for inputing spaces...I tried looking in the FAQ and around the web...but can't find much...here is what I have:
text[] is a dynamic array of size MAX_SIZE or 500000,Code:void readInFileAndGetChars(string fileName, char text[], int& sum) { //declaring variables int i; ifstream inStream; inStream.open(fileName.c_str()); //open user chosen file if ( inStream.fail() ) { //check if file opened right cout << "Input file opening for " << fileName << " failed. Exiting...\n\n"; exit(-1); } for ( i=0; i<MAX_SIZE; i++ ){ //input file into the array inStream >> text[i]; } cout << endl << endl << fileName << " consists of " << MAX_SIZE << " characters. " << endl; }
any hints?
axon