Click here to Skip to main content
15,920,602 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Threadsafe Data Class Pin
softwaremonkey23-Apr-09 9:03
softwaremonkey23-Apr-09 9:03 
GeneralRe: Threadsafe Data Class Pin
led mike23-Apr-09 9:04
led mike23-Apr-09 9:04 
GeneralRe: Threadsafe Data Class Pin
Stuart Dootson23-Apr-09 9:16
professionalStuart Dootson23-Apr-09 9:16 
GeneralRe: Threadsafe Data Class Pin
led mike23-Apr-09 10:09
led mike23-Apr-09 10:09 
AnswerRe: Threadsafe Data Class Pin
Luc Pattyn23-Apr-09 9:19
sitebuilderLuc Pattyn23-Apr-09 9:19 
GeneralRe: Threadsafe Data Class Pin
softwaremonkey23-Apr-09 21:47
softwaremonkey23-Apr-09 21:47 
AnswerRe: Threadsafe Data Class Pin
Roger Stoltz23-Apr-09 22:03
Roger Stoltz23-Apr-09 22:03 
GeneralRe: Threadsafe Data Class Pin
Luc Pattyn24-Apr-09 1:43
sitebuilderLuc Pattyn24-Apr-09 1:43 
Questionuse printf or cout in MFC Pin
johnjitu23-Apr-09 4:35
johnjitu23-Apr-09 4:35 
HEY EVERYBODY

I HAVE A PROJECT BUILT IN MFC AND NOW I WANT TO PRINT SOMETHING IN CONSOLE INSTEAD OF USED THE WINDOWS.
I HAVE TRIED FOLLOWING CODE BUT NOT WORKING ,,,,,GIVE ERROR........

BOOL CMANDTUApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.

#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif


AllocConsole( );

// setup stdout
{
int fd = _open_osfhandle( (long)GetStdHandle( STD_OUTPUT_HANDLE ), 0);
FILE* fp = _fdopen( fd, "w" );

*stdout = *fp;
setvbuf( stdout, NULL, _IONBF, 0 );
}
// setup stdin
{
int fd = _open_osfhandle( (long)GetStdHandle( STD_INPUT_HANDLE ), 0);
FILE* fp = _fdopen( fd, "r" );

*stdin = *fp;
setvbuf( stdin, NULL, _IONBF, 0 );
}

// test stdin & stdout
//std::cout << "Console in place. Type a number: ";
/*
int x = 0;
std::cin >> x;

std::cout << "Value read: " << x << std::endl;

// generated code
*/

FreeConsole();
return FALSE;
}

WELCOME ANY TYPE OF ADVICES ,THANKS IN ADVANCE :
QuestionRe: use printf or cout in MFC Pin
David Crow23-Apr-09 4:45
David Crow23-Apr-09 4:45 
AnswerRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 4:48
johnjitu23-Apr-09 4:48 
GeneralRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 5:01
johnjitu23-Apr-09 5:01 
QuestionRe: use printf or cout in MFC Pin
David Crow23-Apr-09 5:03
David Crow23-Apr-09 5:03 
AnswerRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 5:09
johnjitu23-Apr-09 5:09 
QuestionRe: use printf or cout in MFC Pin
David Crow23-Apr-09 5:10
David Crow23-Apr-09 5:10 
AnswerRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 5:12
johnjitu23-Apr-09 5:12 
GeneralRe: use printf or cout in MFC Pin
Luc Pattyn23-Apr-09 5:15
sitebuilderLuc Pattyn23-Apr-09 5:15 
GeneralRe: use printf or cout in MFC Pin
johnjitu24-Apr-09 0:56
johnjitu24-Apr-09 0:56 
QuestionRe: use printf or cout in MFC Pin
David Crow23-Apr-09 5:15
David Crow23-Apr-09 5:15 
GeneralRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 5:16
johnjitu23-Apr-09 5:16 
GeneralRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 5:26
johnjitu23-Apr-09 5:26 
JokeRe: use printf or cout in MFC Pin
Luc Pattyn23-Apr-09 5:14
sitebuilderLuc Pattyn23-Apr-09 5:14 
AnswerRe: use printf or cout in MFC Pin
Joe Woodbury23-Apr-09 5:47
professionalJoe Woodbury23-Apr-09 5:47 
GeneralRe: use printf or cout in MFC Pin
johnjitu23-Apr-09 5:52
johnjitu23-Apr-09 5:52 
GeneralRe: use printf or cout in MFC Pin
Joe Woodbury23-Apr-09 5:53
professionalJoe Woodbury23-Apr-09 5:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.