gets.html 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
  8. <title>FatFs - fgets</title>
  9. </head>
  10. <body>
  11. <div class="para">
  12. <h2>fgets</h2>
  13. <p>The fgets reads a string from the file.</p>
  14. <pre>
  15. char* fgets (
  16. char* <em>Str</em>, /* Read buffer */
  17. int <em>Size</em>, /* Size of the read buffer */
  18. FIL* <em>FileObject</em> /* File object */
  19. );
  20. </pre>
  21. </div>
  22. <div class="para">
  23. <h4>Parameters</h4>
  24. <dl class="par">
  25. <dt>Str</dt>
  26. <dd>Pointer to read buffer to store the read string.</dd>
  27. <dt>Size</dt>
  28. <dd>Size of the read buffer.</dd>
  29. <dt>FileObject</dt>
  30. <dd>Pointer to the open file object structure.</dd>
  31. </dl>
  32. </div>
  33. <div class="para">
  34. <h4>Return Values</h4>
  35. <p>When the function succeeded, <tt>Str</tt> will be returuned.</p>
  36. </div>
  37. <div class="para">
  38. <h4>Description</h4>
  39. <p>The fgets() is a wrapper function of <a href="read.html">f_read()</a>. The read operation continues until a <tt>'\n'</tt> is stored, reached end of file or buffer is filled with Size - 1 characters. The read string is terminated with a <tt>'\0'</tt>. When the file is already reached end of file or any error occured during read operation, fgets() returns a <tt>NULL</tt>. The EOF status can be examined with <tt>feof()</tt> macro.</p>
  40. <p>This function is available when <tt>_USE_STRFUNC</tt> is 1 or 2. When it is set to 2, <tt>'\r'</tt> contained in the file is stripped.</p>
  41. </div>
  42. <div class="para">
  43. <h4>References</h4>
  44. <p><tt><a href="open.html">f_open</a>, <a href="read.html">f_read</a>, <a href="putc.html">fputc</a>, <a href="puts.html">fputs</a>, <a href="printf.html">fprintf</a>, <a href="close.html">f_close</a>, <a href="sfile.html">FIL</a></tt></p>
  45. </div>
  46. <p class="foot"><a href="../00index_e.html">Return</a></p>
  47. </body>
  48. </html>