reading from stdin on mac via buffer
Posted: Mon Feb 26, 2007 6:53 pm
I'm using this code to read from stdin on MacOS:
It works OK, but doesn't get the final line (which probably doesn't have a "\r" to read). What's the best way to get the last bit?
(this is part of my ongoing battle getting Services to work with ThisService and those Mac applications that use "\r" as line endings... :-))
Code: Select all
(set 'counter 0)
(while (read-buffer 0 'buff 256 "\r")
(print (inc 'counter) { } buff))
(this is part of my ongoing battle getting Services to work with ThisService and those Mac applications that use "\r" as line endings... :-))