作者UNARYvvv (有趣生活)
看板C_and_CPP
标题Re: [问题] dev c++使用windows application
时间Tue Aug 11 22:19:09 2009
1F:推 suhorng:windows application如果要用console的话可以呼叫 win api08/11 11:26
2F:→ suhorng:的 AllocConsole,不过我不知道怎麽把它接上stdin/stdout08/11 11:26
单就这个问题回一下
GUI application 若 AllocConsole() 之後
要接上 stdin/stdout 可以这样做:
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
int x;
scanf("%d", &x);
printf("x = %d\n", x);
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.115.53.23
3F:→ VictorTom:CD中~~等会记得再来补推.... 08/11 22:32
4F:推 VictorTom:推:) 08/11 23:04