Friend, How can open a txt file in Squeak4.1 ,the code Shall be like this:
at: #f put: (FileStream open: '/root/test' mode: FileStream read) !
f do: [ :c | Transcript nextPut: c ] !
f close !
can any body give some hints on how to open the file and do the + – * / equation ?
thanks first 🙂
I’d use one of these methods…
Using the block form above automatically closes the file, you can’t forget. Or..
#contentsOfEntireFile also automatically closes the file, you don’t need to do it again.
In a language with blocks, it just makes no sense to manually close the stream when higher order methods are available that ensure you don’t have to do so.