examples-write-files.fth 395 B

12345678910111213
  1. \ Create a file and write a string to it.
  2. s" output" r/w create-file throw Value output-handle
  3. output-handle s" Hello!" rot write-file throw
  4. output-handle flush-file throw
  5. output-handle close-file throw
  6. \ Put text in piece of memory and write to a file.
  7. s" output" r/w create-file throw Value output-handle
  8. pad 20 accept
  9. \ now type something in, like "hello 123" (without quotes)
  10. pad 100 dump