以下示范了如何在非console程序下打开控制台,个人认为比OutputDebugString更有用哦.

 

#include <stdio.h>

AllocConsole();//打开控制台

if ( freopen("CONOUT$", "w+t", stdout) )
{

      //控制台初始化成功

}

//////

printf("...");

//////

 

fclose(stdout);//关闭控制台

 

各个函数说明

      函数名: freopen

  功 能: 替换一个流

  用 法: FILE *freopen(char *filename, char *type, FILE *stream);

  位置:stdio.h

相关文章:

  • 2021-12-08
猜你喜欢
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
  • 2022-01-07
  • 2022-01-01
相关资源
相似解决方案