]> cloudbase.mooo.com Git - z180-stamp.git/blobdiff - fatfs/documents/doc/findfirst.html
Import fatfs R0.15
[z180-stamp.git] / fatfs / documents / doc / findfirst.html
index daa6de644c0c22a9d010a544f88adeb1721912a6..5f1e34439cb8c52a5086b59ae1b517d093831926 100644 (file)
@@ -61,12 +61,19 @@ FRESULT f_findfirst (
 \r
 <div class="para desc">\r
 <h4>Description</h4>\r
-<p>After the directory specified by <tt class="arg">path</tt> could be opened, it starts to search the directory for items with the name specified by <tt class="arg">pattern</tt>. If the first item is found, the information about the object is stored into the file information structure <tt class="arg">fno</tt>.</p>\r
-<p>The matching pattern can contain wildcard characters (<tt>?</tt> and <tt>*</tt>). A <tt>?</tt> matches an any character and an <tt>*</tt> matches an any string in length of zero or longer. When support of long file name is enabled, only <tt>fname[]</tt> is tested at <tt>FF_USE_FIND == 1</tt> and also <tt>altname[]</tt> is tested at <tt>FF_USE_FIND == 2</tt>. In this revision, there are some differences listed below between FatFs and standard systems in matching condition.</p>\r
+<p>After the directory specified by <tt class="arg">path</tt> could be opened, it starts to search the directory for items with the matching pattern specified by <tt class="arg">pattern</tt>. If the first item is found, the information about the item is stored into the file information structure <tt class="arg">fno</tt>. If not found, <tt>fno-&gt;fname[]</tt> has a null string.</p>\r
+<p>The matching pattern string can contain wildcards. For example:</p>\r
 <ul>\r
-<li><tt>"*.*"</tt> never matches any name without extension while it matches any name with or without extension at the standard systems.</li>\r
-<li>Any pattern terminated with a period never matches any name while it matches any name without extensiton at the standard systems.</li>\r
-<li><a href="filename.html#case">DBCS extended characters</a> are compared in case-sensitive at LFN with ANSI/OEM API.</li>\r
+<li><tt>?</tt> - An any character.</li>\r
+<li><tt>???</tt> - An any string in length of three characters.</li>\r
+<li><tt>*</tt> - An any string in length of zero or longer.</li>\r
+<li><tt>????*</tt> - An any string in length of four characters or longer.</li>\r
+</ul>\r
+<p>Since the matching algorithm uses recursion, number of wildcards in the matching pattern is limited to four to limit the stack usage. Any pattern with too many wildcards does not match any name. In LFN configuration, only <tt>fname[]</tt> is tested when <tt>FF_USE_FIND == 1</tt> and also <tt>altname[]</tt> is tested when <tt>FF_USE_FIND == 2</tt>. There are some differences listed below between FatFs and standard systems in matching condition.</p>\r
+<ul>\r
+<li><tt>"*.*"</tt> does not match any name without extension while it matches any name with or without extension in standard systems.</li>\r
+<li>Any pattern terminated with a dot does not match any name while it matches the name without extensiton in standard systems.</li>\r
+<li><a href="filename.html#case">DBCS extended characters</a> are compared in case-sensitive when LFN is enabled with <tt>!FF_LFN_UNICODE</tt>.</li>\r
 </ul>\r
 </div>\r
 \r
@@ -85,13 +92,13 @@ FRESULT f_findfirst (
 void find_image_file (void)\r
 {\r
     FRESULT fr;     <span class="c">/* Return value */</span>\r
-    DIR dj;         <span class="c">/* Directory search object */</span>\r
+    DIR dj;         <span class="c">/* Directory object */</span>\r
     FILINFO fno;    <span class="c">/* File information */</span>\r
 \r
-    fr = <em>f_findfirst</em>(&amp;dj, &amp;fno, "", "dsc*.jpg");  <span class="c">/* Start to search for photo files */</span>\r
+    fr = <em>f_findfirst</em>(&amp;dj, &amp;fno, "", "????????.JPG"); <span class="c">/* Start to search for photo files */</span>\r
 \r
     while (fr == FR_OK &amp;&amp; fno.fname[0]) {         <span class="c">/* Repeat while an item is found */</span>\r
-        printf("%s\n", fno.fname);                <span class="c">/* Display the object name */</span>\r
+        printf("%s\n", fno.fname);                <span class="c">/* Print the object name */</span>\r
         fr = f_findnext(&amp;dj, &amp;fno);               <span class="c">/* Search for next item */</span>\r
     }\r
 \r