So I need to read in a file, and process the data on each line. The basic format is (character, space, code).
As of yet, I have been able to read in the file and get this correct information, but when it comes to the line with the space character, it looks like:Code:C .--.
My function to read in each line fails on this one, because the >> skips the spaces. I would like to use getline(), but I only need to read in the first character, ignore the second, and read the rest of the line into another variable. The getline and get functions take in character arrays, anyone have ideas on how to fix this problem? I could just use character arrays for the whole thing, but that's wasteful; there has to be another way to accomplish this, anyone know?Code:..-.
Here's my code to read in the lines:
Code:while (!file.eof()) { char ch; char text[9]; file >> ch; file.ignore(); file >> text; }