Computer Science Canada

Read and Write Command Help

Author:  bijx [ Wed Apr 02, 2014 6:37 pm ]
Post subject:  Read and Write Command Help

Hello interwebs,

I am trying to write text files in turing, using the open, put, and get command.

My problem is that I don't fully understand how to use get or read.

This is my command so far but I don't understand what to do with read. What is the part after my stream variable? Why can't I simply ask it to open the whole file?

code:

var stream : int
var test : string
open : stream, "Text.txt", put

get test : *


put : stream, test

read : stream, test


Thanks,
bijx

Author:  Tony [ Wed Apr 02, 2014 8:26 pm ]
Post subject:  RE:Read and Write Command Help

take a look at the documentation for open and go from there.

Something to keep in mind:

- you'd need to specify the operations you will use on the file when opening it, before performing those operations.
- get is easier to understand than read, as the later deals with binary data instead of text.


: