天天看点

windows窗口程序打印信息

#include <io.h>
#include <fcntl.h>
static void OpenConsole()
{    
  AllocConsole();    
  HANDLE   handle   =   GetStdHandle(STD_OUTPUT_HANDLE);    
  int   hCrt   =   _open_osfhandle((long)handle,_O_TEXT);    
  FILE   *   hf   =   _fdopen(   hCrt,   "w"   );    
  *stdout   =   *hf;    
}