Mar 16, 2011 at 7:29pm UTC
I am working on a project where I have to print grid lines on the screen. I have sample code that does this. When I insert the code and #inlcudes into my project it displays a '?'.
The sample code is:
#include <windows.h>
#include <iostream>
#include <tchar.h>
const char graybar = '\xB2';
for(x=0; x<80; x++) // vertical borders
{
y=0;
setxychar(x,y,&graybar,1);
y=24;
setxychar(x,y,&graybar,1);
}
I put this exact code into my project and get a '?' instead of a gray block.
Any help would be appreciated.
Mar 16, 2011 at 8:05pm UTC
You are trying to use a Microsoft character. Make sure your console is set to Code Page 437 (the default) and that you are using the proper font.
Good luck!
Mar 16, 2011 at 8:33pm UTC
I am new enough to this that I don't have a clue what you are talking about.
Where do I find this setting in Visualstudio10 using a win32 platform?
Mar 16, 2011 at 8:49pm UTC
You don't.
How do you run your program?
Mar 16, 2011 at 9:42pm UTC
OK, I run both projects on the same console with the same compiler and one displays a '?' and the other displays a gray block. What am I missing here?
Mar 16, 2011 at 10:19pm UTC
FYI, I had to change the setting in VisualStudio10 from unicode character set to ASCii.
Mar 17, 2011 at 12:07am UTC
Since you figured out what the problem was, you should mark your thread as SOLVED so that others with the same problem can find it.
Glad you got it fixed.