為什麼這篇c open回傳值鄉民發文收入到精華區:因為在c open回傳值這個討論話題中,有許多相關的文章在討論,這篇最有參考價值!作者cris122 (總是很多心事)看板C_and_CPP標題[問題] linux c: fd = ...
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux C
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
如何在已開啟的 fd 中取得他的路徑,
想在 close(fd) 前取得
餵入的資料(Input):
預期的正確結果(Expected Output):
錯誤結果(Wrong Output):
程式碼(Code):(請善用置底文網頁, 記得排版)
int main(){
int fd = open("/home/user/test.bin", O_RDWR | O_CREAT | O_APPEND);
...
//在 close 前取得 /home/user/test.bin 字串
close(fd);
return 0;
}
補充說明(Supplement):
剛搜尋了一下有找到 fstatfs(...) 但好像沒有路徑資訊
不曉得有解嗎?
感恩
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.231.100.109
※ 編輯: cris122 來自: 61.231.100.109 (09/05 10:57)