Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How do I find the end of a line in a file I'm reading?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Sceyef




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: