Search code examples
fileiopostscript

Is there a "File IO in Postscript for Dummies"?


Much of the played on Stack Overflow involved ASCII figures, and codegolf.SE is shaping up the same way.

That's all well and good, but I'd like to inject a little variety into the output, and have written my recent question Output a playable crossword grid explicitly to encourage graphical format entries.

To show willing, I've started trying to hack together a reference implementation in postscript. Alas, I'm completely new to the language, and am having trouble doing basic file IO. Does anyone know of a basic resource that covers the topic?

I am aware of

  • file
  • (%stdin)
  • token
  • readstring
  • readline

but I am pretty unclear on exactly what the last three return and how one manipulates it after you've got it.

I have figured out that several return a <value> <boolean> pair, and that I can use if to test the boolean. Then what?


Solution

  • A good book about postscript is "thinking in postscript" by Gleen Reid. You used to be able to get the book free for personal use from his website, but its down. You can still download it from http://replay.waybackmachine.org/20090621100720/http://www.rightbrain.com/pages/books.html

    Chapter 14 covers file io and has sample code.