]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/Common/FileSystem/FatFs-0.7e/doc/en/printf.html
a6726623018c664541d3eb6b94df260198663a99
[freertos] / FreeRTOS / Demo / Common / FileSystem / FatFs-0.7e / doc / en / printf.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\r
2 <html lang="en">\r
3 <head>\r
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r
5 <meta http-equiv="Content-Style-Type" content="text/css">\r
6 <link rel="up" title="FatFs" href="../00index_e.html">\r
7 <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">\r
8 <title>FatFs - f_printf</title>\r
9 </head>\r
10 \r
11 <body>\r
12 \r
13 <div class="para">\r
14 <h2>f_printf</h2>\r
15 <p>The f_printf function writes formatted string to the file.</p>\r
16 <pre>\r
17 int f_printf (\r
18   FIL* <em>FileObject</em>,     /* File object */\r
19   const char* <em>Foramt</em>,  /* Format stirng */\r
20   ...\r
21 );\r
22 </pre>\r
23 </div>\r
24 \r
25 <div class="para">\r
26 <h4>Parameters</h4>\r
27 <dl class="par">\r
28 <dt>FileObject</dt>\r
29 <dd>Pointer to the open file object structure.</dd>\r
30 <dt>Format</dt>\r
31 <dd>Pointer to the null-terminated format string.</dd>\r
32 <dt>...</dt>\r
33 <dd>Optional arguments.</dd>\r
34 \r
35 </dl>\r
36 </div>\r
37 \r
38 \r
39 <div class="para">\r
40 <h4>Return Values</h4>\r
41 <p>When the function succeeded, number of characters written is returned. When the function failed due to disk full or any error, an <tt>EOF</tt> will be returned.</p>\r
42 </div>\r
43 \r
44 \r
45 <div class="para">\r
46 <h4>Description</h4>\r
47 <p>The f_printf() is a wrapper function of <a href="putc.html">f_putc()</a> and <a href="puts.html">f_puts()</a>. The format control directive is a sub-set of standard library shown as follos:</p>\r
48 <ul>\r
49 <li>Type: <tt>c s d u X</tt></li>\r
50 <li>Size: <tt>l</tt></li>\r
51 <li>Flag: <tt>0</tt></li>\r
52 </ul>\r
53 </div>\r
54 \r
55 \r
56 <div class="para">\r
57 <h4>QuickInfo</h4>\r
58 <p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\n'</tt>s contained in the output are converted to <tt>"\r\n"</tt>.</p>\r
59 </div>\r
60 \r
61 \r
62 <div class="para">\r
63 <h4>Example</h4>\r
64 <pre>\r
65     f_printf(&amp;fil, "%6d", -200);         /* "  -200" */\r
66     f_printf(&amp;fil, "%02u", 5);           /* "05" */\r
67     f_printf(&amp;fil, "%ld", 12345678L);    /* "12345678" */\r
68     f_printf(&amp;fil, "%08lX", 1194684UL);  /* "00123ABC" */\r
69     f_printf(&amp;fil, "%s", "String");      /* "String" */\r
70     f_printf(&amp;fil, "%c", 'a');           /* "a" */\r
71 </pre>\r
72 </div>\r
73 \r
74 \r
75 <div class="para">\r
76 <h4>See Also</h4>\r
77 <p><tt><a href="open.html">f_open</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="gets.html">f_gets</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>\r
78 </div>\r
79 \r
80 <p class="foot"><a href="../00index_e.html">Return</a></p>\r
81 </body>\r
82 </html>\r