Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Trouble with outputting a text from a file
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
JR




PostPosted: 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:


code:

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?
Sponsor
Sponsor
Sponsor
sponsor
Mazer




PostPosted: Thu Feb 12, 2004 10:22 am   Post subject: (No 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 http://www.compsci.ca/v2/viewtopic.php?t=5&highlight=file+handling
McKenzie




PostPosted: Thu Feb 12, 2004 11:00 am   Post subject: (No 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: