Kaynağa Gözat

实现_sys_flen()函数

gztss 6 yıl önce
ebeveyn
işleme
11751d60e0
1 değiştirilmiş dosya ile 10 ekleme ve 0 silme
  1. 10 0
      components/libc/compilers/armlibc/stubs.c

+ 10 - 0
components/libc/compilers/armlibc/stubs.c

@@ -265,7 +265,17 @@ void _sys_exit(int return_code)
  */
 long _sys_flen(FILEHANDLE fh)
 {
+    struct stat stat;
+    
+    if (fh < STDERR)
+        return -1;
+
+#ifndef RT_USING_DFS
     return -1;
+#else
+    fstat(fh, &stat);
+    return stat.st_size;
+#endif
 }
 
 int _sys_istty(FILEHANDLE fh)