[問題] execvp問題

作者: g12288 (史蒂芬)   2014-10-15 22:19:11
開發平台(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):
卡好久了= = 有請高手
作者: L4ys (Lays)   2014-10-15 22:52:00
拿掉 fgets 讀到的 '\n' 就可以了 其實你可以用ltrace debug
作者: g12288 (史蒂芬)   2014-10-15 22:59:00
忘記這件事...= = 謝謝啦L大~

Links booklink

Contact Us: admin [ a t ] ucptt.com