
-----------------------------------
baby_bubblz
Wed Jan 05, 2005 6:13 pm

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?

-----------------------------------
Cervantes
Wed Jan 05, 2005 6:21 pm

Re: transfering text from one document to another
-----------------------------------

get: file2, word
counter := counter + 1
if counter = 7 then
put '\n'

how do you restart the counter?

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
Wed Jan 05, 2005 6:32 pm


-----------------------------------
oh..yes it's supposed to be file1, sorry for the mistake

-----------------------------------
baby_bubblz
Wed Jan 05, 2005 6:46 pm


-----------------------------------
get: file1, word 
counter := counter + 1 
if counter = 7 then 
put '\n' 
put: file2, word    
counter := 0
end if

is this correct?

-----------------------------------
Cervantes
Wed Jan 05, 2005 7:29 pm


-----------------------------------
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 :)

Lastly: [code][/code]tags are nice
