//flex table opened by JP

Click to See Complete Forum and Search --> : I need an idea


nothing
09-12-2004, 12:19 AM
I have a loop that looks something like this:

while(there are words in the file)
read a word
write the word to another file\n


Notice the \n at the end of the line that writes the word to the other file. When it reads the last word, it will leave a blank line at the end of the new file and I don't want that. What would be a efficient way to avoid that? Ideas appreciated :D
Thanks.

DocEvi1
09-12-2004, 10:40 AM
flag = false;
while(there are words in the file)
read a word
if(flag)
write "/n" & word
else
write word
flag = trueThat'd make sure you don't write a new line at the start, and make sure you don't write a line at the end :)

nothing
09-12-2004, 02:55 PM
That works. Thank you :D

DocEvi1
09-12-2004, 03:43 PM
:rolleyes: of course it does ;)

You're welcome :)