Computer Science Canada How do i write to a new line in a text file with variable print? |
Author: | Luganchan [ Wed Feb 26, 2014 8:37 pm ] | ||
Post subject: | How do i write to a new line in a text file with variable print? | ||
I need a program which will read a large paragraph from a text file. It will then output the same paragraph onto a new file. In the new one, each word will be on a new line. I have a working portion, which simply copies the text from one file onto the other, it does not however, make it line by line.
I tried using the \n suffix, but it crashes the program. |
Author: | Dreadnought [ Wed Feb 26, 2014 8:55 pm ] |
Post subject: | Re: How do i write to a new line in a text file with variable print? |
What is the message when the program crashes? |
Author: | Luganchan [ Wed Feb 26, 2014 10:04 pm ] |
Post subject: | RE:How do i write to a new line in a text file with variable print? |
This bit of the code works, but I can't figure out what I need to add to make it write line by line. |
Author: | Dreadnought [ Wed Feb 26, 2014 10:13 pm ] |
Post subject: | Re: How do i write to a new line in a text file with variable print? |
So what goes wrong when you try to append \n to the end of the lines? |
Author: | Nathan4102 [ Wed Feb 26, 2014 10:39 pm ] |
Post subject: | RE:How do i write to a new line in a text file with variable print? |
Perhaps inputting your string, splitting it into seperate words (String array), then writing to your file by iterating through your array would work better? |