[問題] execvp問題

看板C_and_CPP (C/C++)作者 (史蒂芬)時間11年前 (2014/10/15 22:19), 編輯推噓0(002)
留言2則, 2人參與, 最新討論串1/1
開發平台(Platform): (Ex: VC++, GCC, Linux, ...) Linux 額外使用到的函數庫(Library Used): (Ex: OpenGL, ...) unistd.h 問題(Question): 一個簡單的shell,讀入使用者指令,切割,並使用execvp執行命令 懷疑是strtok那邊出錯,但不知道原因 餵入的資料(Input): ls 預期的正確結果(Expected Output): list結果 錯誤結果(Wrong Output): 沒任何東西出來= = 程式碼(Code):(請善用置底文網頁, 記得排版) child process部分程式碼 http://codepad.org/JaekcSyD 補充說明(Supplement): 卡好久了= = 有請高手 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 140.113.136.218 ※ 文章網址: http://www.ptt.cc/bbs/C_and_CPP/M.1413382758.A.49A.html

10/15 22:52, , 1F
拿掉 fgets 讀到的 '\n' 就可以了 其實你可以用ltrace debug
10/15 22:52, 1F

10/15 22:59, , 2F
忘記這件事...= = 謝謝啦L大~
10/15 22:59, 2F
文章代碼(AID): #1KFe9cIQ (C_and_CPP)
文章代碼(AID): #1KFe9cIQ (C_and_CPP)