|
正确的调整平台问题的处理应是这样的(个人认为新手不需要了解这些):
- #ifndef _W32//若处理的不是Windows环境
- #include <unistd.h>//是UNIX或类UNIX(如Linux)环境,需要包含unistd
- #else
- #include <windows.h>//是Windows环境
- #endif
复制代码- #ifdef _W32//是Windows
- system("pause");//system("pause");只在Windows上可用
- #else//非Windows
- printf("Press any key to continue...");
- getch();//因为使用了这条语句,所以需要包含unistd.h
- #endif
复制代码 |
|