zoukankan      html  css  js  c++  java
  • 重定向标准输出到控制台

    #ifdef DISPLAYCONSOLE
        // Redirection of standard output to console
        int hCrt;  BOOL rep;  FILE *hf;
        _SYSTEM_INFO lps;
        GetSystemInfo(&lps);
        rep = AllocConsole();
        hCrt = _open_osfhandle((long) GetStdHandle(STD_OUTPUT_HANDLE),_O_TEXT);
        hf = _fdopen( hCrt, "w" );
        *stdout = *hf;
        // stop the buffer on stdout
        //  int i = setvbuf( stdout, NULL, _IONBF, 0 );
        //  filebuf ff(hCrt);
        //  cout = &ff;
        printf("This Debug Window  will disappear in release mode
    ");
        #endif //  DISPLAYCONSOLE

    还需要在代码中声明

    #define DISPLAYCONSOLE

  • 相关阅读:
    Redis(二)
    Redis
    Nginx
    Linux的环境配置
    深入mysql
    SpringBoot入门
    Thymeleaf入门
    Mybatis之resultMap
    Mybatis入门
    使用第三方实现微信登录
  • 原文地址:https://www.cnblogs.com/mumuli/p/4449156.html
Copyright © 2011-2022 走看看