[問題] 在mac上很基本的執行問題

看板C_and_CPP (C/C++)作者 (平安啦!!)時間10年前 (2015/09/11 16:14), 編輯推噓-1(013)
留言4則, 3人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Mac上使用gcc compiler 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) 應該無 問題(Question):試著使用getch()來達成按任意鍵繼續的行為,但是一直無法成功 餵入的資料(Input): 無,很純粹的一個Hello World程式,主要想試驗按任意鍵繼續的功能 ---- compiler 時在teminal下的command: gcc test.c -lcurses -o test 預期的正確結果(Expected Output): 會先出先"Hello World!" 然後等我按任意鍵繼續才出現"End of Hello World!" 錯誤結果(Wrong Output): "Hello World!"跟"End of Hello World "一起出現 程式碼(Code):(請善用置底文網頁, 記得排版) http://ideone.com/pGbR3o 補充說明(Supplement): 想請問在mac寫C是不是比較不適合呢? 在寫的過程一直遇到在Windows下沒發生過的問題@@ -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 123.194.3.199 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1441959243.A.424.html

09/11 17:08, , 1F
用getch()之前要先initscr();cbreak();noecho();等等
09/11 17:08, 1F

09/11 17:10, , 2F
看來你也想要 nodelay(stdscr,0);
09/11 17:10, 2F

09/11 21:06, , 3F
很基本就別來問
09/11 21:06, 3F

09/13 19:50, , 4F
Xcode自動編譯很強大誒
09/13 19:50, 4F
文章代碼(AID): #1LyerBGa (C_and_CPP)
文章代碼(AID): #1LyerBGa (C_and_CPP)