[問題] linux c: fd = open(...)取得 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)
→
09/05 10:58, , 1F
09/05 10:58, 1F
推
09/05 11:14, , 2F
09/05 11:14, 2F
→
09/05 11:21, , 3F
09/05 11:21, 3F
推
09/05 13:10, , 4F
09/05 13:10, 4F
→
09/05 13:21, , 5F
09/05 13:21, 5F
→
09/05 13:22, , 6F
09/05 13:22, 6F
→
09/05 13:45, , 7F
09/05 13:45, 7F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章