-
November 6th, 2003, 10:05 PM
#1
Print Variables
Hey all,
As stated before, I'm new to MFC programming. I come from the old DOS days. MS Quick C.
So here is my problem. During programming, I usually will put a few print statements in the code to monitor varibles or to mark that a function has been reached. Used to be I just used printf or the old _outtext(array,"CCC"var);
Well -outtext isn't in the lib and printf will not put anything to screen. Unless it's writing in the same color as my background.
So in short, I need to know how to quickly print a literal string/char or varible to screen.
Thanks. And yes I did look on the Code Guru pages/f.a.q. but couldn't find anything that would help.
Again, Thanks in advance for any and all responses
Jerry
-
November 6th, 2003, 11:46 PM
#2
Maybe you can using std::cout, which prints the variables' value to screen. For most funtamental types, std defined the operator <<, which performs output operation. For a customized type, you should also define the operator <<.
-
November 7th, 2003, 02:00 AM
#3
Thanks Icy,
I tried the cout<< but it wouln't print to screen. I had also tried printf. Same result. I believe the issue is I am writing an MFC window and not a console app. I could be wrong though.
I ended up using TextOut as such...
void C_MainFrame::OnStart()
{
CClientDC StartDC(this);
if(C_MainFrame::C_Status == 'J')
C_MainFrame::C_Status = 'G' ;
if(C_MainFrame::P_Status == 'J')
C_MainFrame::P_Status = 'H' ;
StartDC.TextOut(10,10, C_MainFrame::C_Status);
StartDC.TextOut(30,10, C_MainFrame::P_Status);
}
Probably not the best way but it worked and now I can delete it and continue on with the program
Thanks again.
Jerry
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|