1. 程式人生 > >linux c getchar()實用演示源碼

linux c getchar()實用演示源碼

line 應該 red printf ret 關於 之前 etc tchar

將寫代碼過程中重要的代碼做個備份,如下代碼內容是關於linux c getchar()實用演示的代碼,應該對小夥伴有一些用。

  ```
#include <stdio.h>
  int main(void)
  {
  int c;
  is line buffered; this means it will
  while ((c = getchar()) != ‘n‘)
  printf("%c", c);
  return 0;
  }



  註:可以利用getchar()函數讓程序調試運行結束後等待編程者按下鍵盤才返回編輯界面,用法:在主函數結尾,return0;之前加上getchar();即可

linux c getchar()實用演示源碼