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

Username:   Password: 
 RegisterRegister   
 transfering text from one document to another
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
baby_bubblz




PostPosted: Wed Jan 05, 2005 6:13 pm   Post subject: transfering text from one document to another

hey, can someone please help me with a problem i have? it would be great..thanks!

question: how do you take text from a txt document (file)and transfer it into another txt (file2), but change it so that there are only 7 words on each line?

i know everything up to the part where you change the style of the text, i already declared the word and counter variable

get: file2, word
counter := counter + 1
if counter = 7 then
put '\n'

how do you restart the counter?
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Wed Jan 05, 2005 6:21 pm   Post subject: Re: transfering text from one document to another

baby_bubblz wrote:

get: file2, word
counter := counter + 1
if counter = 7 then
put '\n'

how do you restart the counter?

code:

counter := 0

It looks like, in your code, you are getting data from file2. Maybe I misunderstood something, but aren't you supposed to write data to file2, and get the data from file1?
baby_bubblz




PostPosted: Wed Jan 05, 2005 6:32 pm   Post subject: (No subject)

oh..yes it's supposed to be file1, sorry for the mistake
baby_bubblz




PostPosted: Wed Jan 05, 2005 6:46 pm   Post subject: (No subject)

get: file1, word
counter := counter + 1
if counter = 7 then
put '\n'
put: file2, word
counter := 0
end if

is this correct?
Cervantes




PostPosted: Wed Jan 05, 2005 7:29 pm   Post subject: (No subject)

Well, I haven't had much experience with files in Turing, but I don't think that's going to work. The reason? Look at the put statement. You're not putting the '\n' to file2, you're outputting it to the screen. Wink
Also, I don't know whether your method of putting a '\n' is viable. It may work, it may not. I'm not sure, it depends on how Turing deals with that character. In any case, try it out, and see what you get Smile

Lastly:
code:
[code][/code]tags are nice
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  [ 5 Posts ]
Jump to:   


Style:  
Search: