Reading in a file in the io programming language

I want to read a simple text file using I / O language and print it on the screen, so far I have:

f := File with("test.txt")
f openForReading

but just don’t know how to print it or clone the contents for an object. If anyone knows anything or can point me in a good direction, it will be very appreciated.

+4
source share
4 answers

It turns out that it is very simple, simple f contents. For any future reference to checking existing methods for an object in io, you can use protos, for example.f protos

+1
source

From the interactive shell io>, have you tried?

f print

or

doString(f)

Watch this blog

+1

readLine println . ​​

f := File with(fileName)
f openForReading

l := f readLine
l println
0

File :

fileName := "yourFileName.txt"
file := File with(fileName)

file open
fileText := file readToEnd

Then close the file.

file close 

Then you should use the 'fileText' variable.

0
source

All Articles