Computer Science Canada

Trouble with outputting a text from a file

Author:  JR [ Thu Feb 12, 2004 9:13 am ]
Post subject:  Trouble with outputting a text from a file

Well, i'm trying to output a text from a file but it just doesnt work.
here is my program:


var w : string
var i, x : int
x := 0
open : i, "H://To_Be_Read.txt", put, seek, mod
seek : i, *
put i, ""
for z : 1 .. 7
    get w
end for
put : i, " "
put : i, "the Words are "
close : i

any ideas on whats wrong?

BTW: how do i input something that i write in turing into a file?

Author:  Mazer [ Thu Feb 12, 2004 10:22 am ]
Post subject: 

Well, judging by the fact that you don't seem to know how to get data from a text file, I would say that you should be trying to get it as normal text instead of in binary.
Check out this tutorial on it

Author:  McKenzie [ Thu Feb 12, 2004 11:00 am ]
Post subject: 

No, it's text, just very few people use seek with text. It will give you the number of bytes in the file (ie number of characters). It looks like you are hoping to get the number of words. Your best solution is to check for eof.