[問題] ftw小測試
第一次使用ftw這個函式
寫了一個測試
程式碼如下
1 #include<sys/stat.h>
2 #include<unistd.h>
3 #include<ftw.h>
4 #include<stdio.h>
5 int fn(const char *file, const struct stat *sb, int flag)
6 {
7 printf("%s",file);
8 return 0;
9 }
10 int main()
11 {
12 printf("%d",ftw("/",fn,500));
13 return 0;
14 }
結果是印出代表錯誤的"-1"
不知道是不是函式用法錯了
有大大能解答嗎???
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.233.149.27
推
03/20 03:48, , 1F
03/20 03:48, 1F
推
03/20 06:43, , 2F
03/20 06:43, 2F
→
03/20 06:43, , 3F
03/20 06:43, 3F
→
03/20 06:44, , 4F
03/20 06:44, 4F
→
03/20 10:12, , 5F
03/20 10:12, 5F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章