]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/documents/doc/stat.html
Import fatfs R0.15
[z180-stamp.git] / fatfs / documents / doc / stat.html
index db636675ef41161efe7f922ab052d0b9ee1ab4cf..a4e4fc881906c3c0f84611f061f6b21e8b5b3d36 100644 (file)
@@ -28,7 +28,7 @@ FRESULT f_stat (
 <dt>path</dt>\r
 <dd>Pointer to the null-terminated string that specifies the <a href="filename.html">object</a> to get its information. The object must not be the root direcotry.</dd>\r
 <dt>fno</dt>\r
-<dd>Pointer to the blank <tt>FILINFO</tt> structure to store the information of the object. Set null pointer if it is not needed.</dd>\r
+<dd>Pointer to the blank <tt>FILINFO</tt> structure to store the information of the object. Set null pointer if this information is not needed.</dd>\r
 </dl>\r
 </div>\r
 \r
@@ -54,7 +54,8 @@ FRESULT f_stat (
 \r
 <div class="para desc">\r
 <h4>Description</h4>\r
-<p>The <tt>f_stat</tt> function checks the existence of a file or sub-directory. If not exist, the function returns with <tt>FR_NO_FILE</tt>. If exist, the function returns with <tt>FR_OK</tt> and the informations of the object, file size, timestamp and attribute, are stored to the file information structure. For details of the file information, refer to the <tt>FILINFO</tt> structure and <a href="readdir.html"><tt>f_readdir</tt></a> function.</p>\r
+<p>The <tt>f_stat</tt> function checks the existence of a file or sub-directory in the directory. If it is not exist, the function returns with <tt>FR_NO_FILE</tt>. If it is exist, the function returns with <tt>FR_OK</tt> and the informations about the object, size, timestamp and attribute, is stored to the file information structure. For details of the file information, refer to the <tt>FILINFO</tt> structure and <a href="readdir.html"><tt>f_readdir</tt></a> function.</p>\r
+<p>Note that the file information comes from the meta data in the directory. If the file has been opend and modified, the file will need to be synched or closed in order to obtain the latest file information.</p>\r
 </div>\r
 \r
 \r
@@ -69,16 +70,17 @@ FRESULT f_stat (
 <pre>\r
     FRESULT fr;\r
     FILINFO fno;\r
+    const char *fname = "file.txt";\r
 \r
 \r
-    printf("Test for 'file.txt'...\n");\r
+    printf("Test for \"%s\"...\n", fname);\r
 \r
-    fr = f_stat("file.txt", &amp;fno);\r
+    fr = <em>f_stat</em>(fname, &amp;fno);\r
     switch (fr) {\r
 \r
     case FR_OK:\r
         printf("Size: %lu\n", fno.fsize);\r
-        printf("Timestamp: %u/%02u/%02u, %02u:%02u\n",\r
+        printf("Timestamp: %u-%02u-%02u, %02u:%02u\n",\r
                (fno.fdate &gt;&gt; 9) + 1980, fno.fdate &gt;&gt; 5 &amp; 15, fno.fdate &amp; 31,\r
                fno.ftime &gt;&gt; 11, fno.ftime &gt;&gt; 5 &amp; 63);\r
         printf("Attributes: %c%c%c%c%c\n",\r
@@ -90,7 +92,7 @@ FRESULT f_stat (
         break;\r
 \r
     case FR_NO_FILE:\r
-        printf("It is not exist.\n");\r
+        printf("\"%s\" is not exist.\n", fname);\r
         break;\r
 \r
     default:\r