EOF.htm 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <html>
  2. <head>
  3. <title>Blitz3D Docs</title>
  4. <link rel=stylesheet href=../css/commands.css type=text/css>
  5. </head>
  6. <body>
  7. <h1>Eof (filehandle/stream)</h1>
  8. <h1>Parameters</h1>
  9. <table>
  10. <tr>
  11. <td>
  12. filehandle/stream = a valid variable set with the OpenFile, ReadFile command, or OpenTCPStream (v1.52+)
  13. </td>
  14. </tr>
  15. </table>
  16. <h1>Description</h1>
  17. <table>
  18. <tr>
  19. <td>
  20. Checks to see if the End of File of an opened file or stream has been reached. Use this to determine if you should continue to pull more information from a file/stream or not. Use this to read a text file of unknown length (say a README.TXT) and display it. See example. <br />
  21. <br />
  22. Eof returns 1 if eof has been reached or, in the case of a TCP stream, the stream has been 'nicely' closed. <br />
  23. <br />
  24. Eof returns -1 if something has gone wrong during stream processing. <br />
  25. <br />
  26. Streams can only be used in Blitz Basic v1.52 or greater.
  27. </td>
  28. </tr>
  29. </table>
  30. <h1><a href=../2d_examples/Eof.bb>Example</a></h1>
  31. <table>
  32. <tr>
  33. <td>
  34. ; Eof sample <br />
  35. <br />
  36. file$="c:autoexec.bat" <br />
  37. <br />
  38. filein = ReadFile(file$) <br />
  39. <br />
  40. Print "Here is your Autoexec.bat file ..." <br />
  41. <br />
  42. ; Loop this until we reach the end of file <br />
  43. While Not Eof(filein) <br />
  44. Print ReadLine$(filein) <br />
  45. Wend <br />
  46. </td>
  47. </tr>
  48. </table>
  49. <br>
  50. <a target=_top href=../index.htm>Index</a><br>
  51. <br>
  52. Click <a href=http://www.blitzbasic.co.nz/b3ddocs/command.php?name=Eof&ref=comments target=_blank>here</a> to view the latest version of this page online</body>
  53. </html>