correct me if i am wrong but i thought my file i/o code done this:
line 19 story="story text some more text \n more text";
line 20 options="option text \n more \n more \n";
so how is that any different from the following code that works?
I really want and need to understand how they are different.
1 2 3 4 5 6
string test="this is line one \nthis is a new line";
this is line one
this is a new line
so for some reason they are not special. I need to make a sub-task that finds the chars "/" "n" together and replaces them with the actual newline character. BTW what is the newline character I will be using?? I thought it was /n?
also any ideas on how to go about this if the /n is attached to the word as in string test with "\nthis"? with this example i cant just look for the word "/n".
How to go about it? Read a line of text in from the file. Iterate through the line of text looking for '\' followed by 'n'. When the pair is found, delete the '\' and replace the 'n' with '\n'. Note that because \ is an escape sequence, the proper character literal for a backslash is actually '\\'. When you reach the end of line, continue with reading the next line of text from the file until you reach eof.