Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignoring 20 characters

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have the following txt file:

S San Diego 4 20:30

------------------------
**San Diego can be the name of any city not more than 20 characters long***
How do I make the read in statment to ignore what comes after S. (Means maxiumum 20 characters and then continue reading).


Thanks GUYS
 
Well if the City Name is padded with spaces to a max of 20 chars simply move the file pointer forward 20 bytes, then start reading. However, if the City name is unknown you will have to read it a byte at a time until you come to say a space then read the next byte. Check this byte to see if it's a char if it is you (in theroy) could assume thats it's a continuation of a City name, like San Diego. On the other hand if it's number you can (in theory) assume that you are now at the position from where you want to read from and continue your processing.

HTH

William
Software Engineer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top