Computer Science Canada How do I find the end of a line in a file I'm reading? |
Author: | Sceyef [ Thu Oct 15, 2015 11:13 am ] |
Post subject: | How do I find the end of a line in a file I'm reading? |
I am reading a file with multiple lines, how would I detect when I get to the end of a line inside the file (it's a txt)? edit: Furthermore, how could I read one character at a time |
Author: | Insectoid [ Thu Oct 15, 2015 6:40 pm ] |
Post subject: | RE:How do I find the end of a line in a file I\'m reading? |
The eof command will return true if you have reached the end of the file and false otherwise. To read one character at a time, you can use the : operator on the get command. get a : 1 will read on character. get a : 5 will read 5, and get a : * will read an entire line of input. Alternatively, if a is of type char, then get a will read only one character. |