Solaron
asked on
Fairly simple: How do i scan in a string until END OF LINE?
I am reading in a text file from a program called DL_POLY and i want to manipulate it with a small c program (these input files are HUGE otherwise i would have done it by hand)
The first line is the title, second line as 2 numbers that represent some other info.
So, very basic question:
How do i get it to automaitcally read in that title line and store it into ONE variable? i'm having froube getting the code to recognise that the end of the line is the end of the variable.
Any hints are appreciated
Chris
The first line is the title, second line as 2 numbers that represent some other info.
So, very basic question:
How do i get it to automaitcally read in that title line and store it into ONE variable? i'm having froube getting the code to recognise that the end of the line is the end of the variable.
Any hints are appreciated
Chris
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you have file that has a particular patter, you might consider using
fscanf()
http://www.crasseux.com/books/ctutorial/fscanf.html
Check this tutorial.
http://computer.howstuffworks.com/c19.htm
Regards,
siddhesh
fscanf()
http://www.crasseux.com/books/ctutorial/fscanf.html
Check this tutorial.
http://computer.howstuffworks.com/c19.htm
Regards,
siddhesh
>> If the last character in the string if a '\n'
should be :
>> If the last character in the string is a '\n'