]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/documents/doc/stat.html
Import fatfs R0.13b
[z180-stamp.git] / fatfs / documents / doc / stat.html
diff --git a/fatfs/documents/doc/stat.html b/fatfs/documents/doc/stat.html
new file mode 100644 (file)
index 0000000..db63667
--- /dev/null
@@ -0,0 +1,110 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
+<html lang="en">\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">\r
+<meta http-equiv="Content-Style-Type" content="text/css">\r
+<link rel="up" title="FatFs" href="../00index_e.html">\r
+<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/stat.html">\r
+<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">\r
+<title>FatFs - f_stat</title>\r
+</head>\r
+\r
+<body>\r
+\r
+<div class="para func">\r
+<h2>f_stat</h2>\r
+<p>The f_stat function checks the existence of a file or sub-directory.</p>\r
+<pre>\r
+FRESULT f_stat (\r
+  const TCHAR* <span class="arg">path</span>,  <span class="c">/* [IN] Object name */</span>\r
+  FILINFO* <span class="arg">fno</span>        <span class="c">/* [OUT] FILINFO structure */</span>\r
+);\r
+</pre>\r
+</div>\r
+\r
+<div class="para arg">\r
+<h4>Parameters</h4>\r
+<dl class="par">\r
+<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
+</dl>\r
+</div>\r
+\r
+\r
+<div class="para ret">\r
+<h4>Return Values</h4>\r
+<p>\r
+<a href="rc.html#ok">FR_OK</a>,\r
+<a href="rc.html#de">FR_DISK_ERR</a>,\r
+<a href="rc.html#ie">FR_INT_ERR</a>,\r
+<a href="rc.html#nr">FR_NOT_READY</a>,\r
+<a href="rc.html#ok">FR_NO_FILE</a>,\r
+<a href="rc.html#np">FR_NO_PATH</a>,\r
+<a href="rc.html#in">FR_INVALID_NAME</a>,\r
+<a href="rc.html#id">FR_INVALID_DRIVE</a>,\r
+<a href="rc.html#ne">FR_NOT_ENABLED</a>,\r
+<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,\r
+<a href="rc.html#tm">FR_TIMEOUT</a>,\r
+<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>\r
+</p>\r
+</div>\r
+\r
+\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
+</div>\r
+\r
+\r
+<div class="para comp">\r
+<h4>QuickInfo</h4>\r
+<p>Available when <tt><a href="config.html#fs_minimize">FF_FS_MINIMIZE</a> == 0</tt>.</p>\r
+</div>\r
+\r
+\r
+<div class="para use">\r
+<h4>Example</h4>\r
+<pre>\r
+    FRESULT fr;\r
+    FILINFO fno;\r
+\r
+\r
+    printf("Test for 'file.txt'...\n");\r
+\r
+    fr = f_stat("file.txt", &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
+               (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
+               (fno.fattrib &amp; AM_DIR) ? 'D' : '-',\r
+               (fno.fattrib &amp; AM_RDO) ? 'R' : '-',\r
+               (fno.fattrib &amp; AM_HID) ? 'H' : '-',\r
+               (fno.fattrib &amp; AM_SYS) ? 'S' : '-',\r
+               (fno.fattrib &amp; AM_ARC) ? 'A' : '-');\r
+        break;\r
+\r
+    case FR_NO_FILE:\r
+        printf("It is not exist.\n");\r
+        break;\r
+\r
+    default:\r
+        printf("An error occured. (%d)\n", fr);\r
+    }\r
+</pre>\r
+</div>\r
+\r
+\r
+<div class="para ref">\r
+<h4>References</h4>\r
+<p><tt><a href="opendir.html">f_opendir</a>, <a href="readdir.html">f_readdir</a>, <a href="sfileinfo.html">FILINFO</a></tt></p>\r
+</div>\r
+\r
+<p class="foot"><a href="../00index_e.html">Return</a></p>\r
+</body>\r
+</html>\r