func_streams_writestream.rst 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. .. _func_streams_writestream:
  2. ===========
  3. WriteStream
  4. ===========
  5. WriteStream -
  6. Description
  7. ===========
  8. .. code-block:: blitzmax
  9. WriteStream:TStream( url:Object )
  10. Open a stream for writing
  11. All streams created by #OpenStream, #ReadStream or #WriteStream should eventually
  12. be closed using #CloseStream.
  13. Parameters
  14. ==========
  15. Return Values
  16. =============
  17. A stream object
  18. Examples
  19. ========
  20. .. code-block:: blitzmax
  21. ' writestream.bmx
  22. ' opens a write stream to the file mygame.ini and
  23. ' outputs a simple text file using WriteLine
  24. out=WriteStream("mygame.ini")
  25. if not out RuntimeError "Failed to open a WriteStream to file mygame.ini"
  26. WriteLine out,"[display]"
  27. WriteLine out,"width=800"
  28. WriteLine out,"height=600"
  29. WriteLine out,"depth=32"
  30. WriteLine out,""
  31. WriteLine out,"[highscores]"
  32. WriteLine out,"AXE=1000"
  33. WriteLine out,"HAL=950"
  34. WriteLine out,"MAK=920"
  35. CloseStream out
  36. print "File mygame.ini created, bytes="+FileSize("mygame.ini")
  37. See Also
  38. ========