Using STDIN with an AllocConsole()

前端 未结 4 1841
北荒
北荒 2021-01-05 06:00

I have a third-party dll that I load into software that isn\'t mine, and I\'m using AllocConsole() to create the standard windows CLI window so I have an easy means of outpu

4条回答
  •  不思量自难忘°
    2021-01-05 06:36

    Thanks to Ben Voigt, I was able to cause the console to take input after I allocated it by doing:

    freopen("CONIN$", "r", stdin); 
    freopen("CONOUT$", "w", stdout); 
    freopen("CONOUT$", "w", stderr); 
    

    This also directs the stdout and strerr to the same console window, in case they are directed someplace else for some reason.

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题