I'm trying to read character by character from a text file until EOF, put them into a character array, so that I can manipulate it after. Compiled with g++ without errors, and when run, I'm prompted for the input file but then it just hangs.
int main (int argc, char *argv[]) { string filename; ifstream infile; char *cp, c[1024]; memset (c, 0, sizeof(c)); cp = c; cout << "Enter file name: " << endl; cin >> filename; //open file infile.open( filename.c_str() ); //if file can't open if(!infile) { cerr << "Error: file could not be opened" << endl; exit(1); } while (!infile.eof()); { infile.get(c, sizeof(infile)); // get character from file and store in array c[] } }//end main