Hi! I'm trying to read a text file one character at time, but the fstream get() function read some crap after the character. Here is my code:
for (int i = 0; i < MAP_SIZE; i++)
{
for (int j = 0; j < MAP_SIZE; j++)
{
file.get(a); // reads a char
char* b = const_cast<char*>(&a); // convert to no-const
textout_ex(screen, font, b, x, y, makecol(0, 0, 0), makecol(255, 255, 255)); // print it
x += 20;
}
x = 250;
y += 20;
}
Bookmarks