gets.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html lang="en">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  5. <meta http-equiv="Content-Style-Type" content="text/css">
  6. <link rel="up" title="FatFs" href="../00index_e.html">
  7. <link rel="alternate" hreflang="ja" title="Japanese" href="../ja/gets.html">
  8. <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
  9. <title>FatFs - f_gets</title>
  10. </head>
  11. <body>
  12. <div class="para func">
  13. <h2>f_gets</h2>
  14. <p>The f_gets reads a string from the file.</p>
  15. <pre>
  16. TCHAR* f_gets (
  17. TCHAR* <span class="arg">buff</span>, <span class="c">/* [OUT] Read buffer */</span>
  18. int <span class="arg">len</span>, <span class="c">/* [IN] Size of the read buffer */</span>
  19. FIL* <span class="arg">fp</span> <span class="c">/* [IN] File object */</span>
  20. );
  21. </pre>
  22. </div>
  23. <div class="para arg">
  24. <h4>Parameters</h4>
  25. <dl class="par">
  26. <dt>buff</dt>
  27. <dd>Pointer to read buffer to store the read string.</dd>
  28. <dt>len</dt>
  29. <dd>Size of the read buffer in unit of character.</dd>
  30. <dt>fp</dt>
  31. <dd>Pointer to the open file object structure.</dd>
  32. </dl>
  33. </div>
  34. <div class="para ret">
  35. <h4>Return Values</h4>
  36. <p>When the function succeeded, <tt class="arg">buff</tt> will be returuned.</p>
  37. </div>
  38. <div class="para desc">
  39. <h4>Description</h4>
  40. <p>The read operation continues until a <tt>'\n'</tt> is stored, reached end of the file or the buffer is filled with <tt>len - 1</tt> characters. The read string is terminated with a <tt>'\0'</tt>. When no character to read or any error occured during read operation, it returns a null pointer. The status of EOF and error can be examined with <tt>f_eof</tt> and <tt>f_error</tt> function.</p>
  41. <p>When FatFs is configured to Unicode API (<tt>_LFN_UNICODE == 1</tt>), data types on the srting fuctions, <tt>f_putc</tt>, <tt>f_puts</tt>, <tt>f_printf</tt> and <tt>f_gets</tt>, is also switched to Unicode. The character encoding on the file to be read/written via those functions is selected by <tt>_STRF_ENCODE</tt> option.</p>
  42. </div>
  43. <div class="para comp">
  44. <h4>QuickInfo</h4>
  45. <p>This is a wrapper function of <a href="read.html"><tt>f_read</tt></a> function. Available when <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\r'</tt>s contained in the file are stripped out.</p>
  46. </div>
  47. <div class="para ref">
  48. <h4>See Also</h4>
  49. <p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">f_putc</a>, <a href="puts.html">f_puts</a>, <a href="printf.html">f_printf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
  50. </div>
  51. <p class="foot"><a href="../00index_e.html">Return</a></p>
  52. </body>
  53. </html>