c++ - How to read spaces from .txt file in QT -
i trying load sample text file 8488 characters (including spaces) can organise words in text file alphabetical order in gui (to create dictionary essentially).
the .txt file loads text can not read spaces file, shows of words no spaces between
i have class dictionary
, within dictionary.cpp source file attempt load , read text file shown below.
void dictionary::loadfile(const char *filename) { char value; ifstream f_in(filename); if (!f_in) { cerr << "\nerror loading file!" << endl; exit(1); } else { cout << "file loaded successfully\n" << endl; } (int = 0; < 8488; i++) { f_in >> value; memory[i] = value; cout << memory[i]; } }
can explain may have went wrong?
i'm quite new working classes, particularly in qt creator.
issue has been fixed.
i used
f_in >> noskipws;
to acknowledge white spaces.
Comments
Post a Comment