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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading data from a .txt file in case it is not formatted

Status
Not open for further replies.

Opteron

Technical User
Sep 14, 2010
4
0
0
GR
Dear all,

i am trying to make a small qbasic program that reads some data from a text file. The part of the text i am interested in is "Dipole=X,Y,Z" where X,Y,Z are numbers. This would be rather trivial if the position of the word "Dipole" was fixed (say the first word in a line of the txt file". But the problem is that it's position changes in each file. The X,Y,Z numbers also do not have a specific length (the length varies). Is there any way to make qbasic locate where in the text file the word dipole is and then read the three numbers after it?

Thank you!
 
Well, you could read the line then search for the word and the commas as markers, then extract as value=mid$(startposition,length).

This from GW but seem to remember doing it with Q.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
also, use line input var$ then do the search for the commas and check for numbers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top