I'm using fstream to read words from a file and I can't just read the whole word like so:
ifstream ob("file.txt");
string word;
ob >> word;
But I need to somehow specify to read 20 positions, even though there might be just spaces included. So I was trying to do something like this:
ifstream ob("file.txt");
char word[20];
ob.read(word, 20);
but when I cout this everything seem to be normal except the last element (word[20]) is some kind of a weird symbol, here's an example of what I mean: