I am trying to store the contents of a text file into a char array. However the function i am using ifstream member function get(); seems to stop working when fed with certain characters. Is there another solution besides the get() function that will accept all types of characters from files?
1 2 3 4 5
char text[1000];
for (int i = 0; i <= textlen; ++i)
{
text[i] = text_in.get();
}
The character wont properly display but it is a right pointing arrow like this one '→' only smaller at the same font. I dont know if this is the only one but this is the first one i am certain produces an error
I'm guessing the file is in UTF-8 or something?
get() and other formatted functions don't really work on non-ASCII files (the actual situation is complicated). To properly read such files, it's best to open them as binary files and decode them by hand.