[self-interest] file streams

Russell Allen mail at russell-allen.com
Tue Jun 9 01:04:24 UTC 2015


Hi,
The place to start is with the unusually named ‘os_file’
If you get it, you will find it has two important traits, ‘traits unixFile’ which in turn delegates to ‘traits abstractFile’
These have methods for opening, reading and writing from files (and also sockets). 
Basically start with os_file and look upwards at its parents.

As a simple example:

| f |
f: os_file openForReading: ‘myfile.txt’ IfFail: [|:e | ^ ‘Oh no! Something went wrong’ ].
[f atEnd] whileFalse: [
	f readLine printString].
f close

Hope this helps,
Russell


> On 8 Jun 2015, at 1:18 am, ddp at electric-loft.org [self-interest] <self-interest at yahoogroups.com> wrote:
> 
> 
> What's the recommended way to access file streams in Self?  The section in the 4.5 Handbook on I/O and Unix is a little light.  I'm on OS X.
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.selflanguage.org/pipermail/self-interest/attachments/20150609/4179bdf4/attachment.html>


More information about the Self-interest mailing list