Lyr*_*yrk 2 c getch visual-studio-2008
下面的代码适用于DevC++,MinGW可以完美地工作,但Visual Studio 2008吐出这个:
error C3861: 'getch': identifier not found .
Run Code Online (Sandbox Code Playgroud)
如果不可能接受getch(),我可以做些什么来替换getch(),我可以使用它来暂停屏幕?
码:
#include <stdio.h>
#include <conio.h>
int main(void){
char str[] = "This is the end";
printf("%s\n", str);
getch(); //I tried getchar() also still does not work
return 0;
}
Run Code Online (Sandbox Code Playgroud)
使用_getch()
例如
#define getch() _getch()
Run Code Online (Sandbox Code Playgroud)
样品
#include <stdio.h>
#include <conio.h>
#ifdef _MSC_VER
#define getch() _getch()
#endif
int main(void){
char str[] = "This is the end";
printf("%s\n", str);
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20365 次 |
| 最近记录: |