Contact US

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.

Students Click Here

Sorting a QB45 file

Sorting a QB45 file

Sorting a QB45 file

Let me briefly explain: I'm writing a little tool that will help me to create text based adventure games using an engine I wrote a few years back. The problem is, sometimes a line will be printed out of order (because otherwise I would have to plan everything in advance). Here's an example of what I mean:
10 PRINT "One ";
30 PRINT "Three ";
20 PRINT "Two ";
And QBASIC will read this and print "One Three Two ", as opposed to "One Two Three".

So is there any batch file, or QB code that I can use to sort the line numbers of my generated BAS files? I would greatly appreciate the help! Thanks in advance,

RE: Sorting a QB45 file

If all lines are numbered, then just put the line numbers in an array and sort them. There are lots of sort routines around. You could even use the dos sort if thats available on your os. If you use the sorted array approach, once sorted, go back and check the line up to len of the array versus the array and write it to another file or print.

If you are using QuickBasic then be sure to save the original program as a text file.

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! Already a Member? Login

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