我目前正在學習使用OpenGL,並開始我正在遵循http://www.opengl-tutorial.org/的一系列教程。用「fprintf」打印錯誤後調用「getchar()」是什麼意思?
在第一個教程,他們開始的main()這個if語句:
// Initialize GLFW
if (!glfwInit())
{
fprintf(stderr, "failed to initialize GLFW\n");
getchar();
return -1;
}
據我所知,fprintf中是一個緩衝的打印這是一種用於指示錯誤的標準。返回-1也是有意義的。但是在指出錯誤之後調用getchar()有什麼意義?
感謝。
通過等待用戶輸入來阻止應用程序關閉。 –
可能的重複:[在C程序完成時暫停屏幕](http://stackoverflow.com/questions/9386651/pause-screen-at-program-completion-in-c) – NathanOliver
它只是在那裏,所以你必須擊中任何鑰匙在繼續之前。 –