INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

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

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

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

(OP)
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!

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

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.

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

also, use line input var$ then do the search for the commas and check for numbers.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close