Re: fstream.get() - Problem
Sorry...
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;
}
Re: fstream.get() - Problem
1) I assume that "a" is a char
2) I assume that textout_ex takes a char* variable that is NULL terminated.
Simply casting a char to a char * will not NULL terminate the string.
The simplest solution is probably:
Code:
char b[2] = { 0 , 0 };
file.get( &b[0] );
text_out( .... );