Results 1 to 8 of 8

Thread: QBasic

  1. #1
    Senior Member
    Join Date
    Oct 2001
    Posts
    677

    Talking QBasic

    After reading the AO newsletter this morning (My comp.s been dead for a while so I haven't been able to check AO for a whole) I decided to look through my old QBasic programs and find one to upload for some of you to take a look at if you're interested in QBASIC programming. Anyway, there was one program I was particularly proud of - I wrote it for my sister to use (she was 8 at the time) and it took travel bookings, printed out holiday tickets and information etc. Anyway, she loved it, and it evolved through 8 versions, the latest one inclusing colour text and even sound!

    However, it was stored on a floppy disk somewhere and has now been lost, so instead I wrote something new today. It's quite "Basic", but it's an address book system. I plan to upgrade it and improve it as well, see if I can still remember all the neat QBasic tricks I learned when i did the travel booking system!!

    Anyway, it's attached as a zip file containing the .BAS program file and a file called address.txt in which the program stores its addresses.
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  2. #2
    Senior Member
    Join Date
    Oct 2001
    Posts
    677

    Exclamation

    Here's version 1.1
    It adds color to version 1.0 but will not open address book files from 1.0 because of a change in the file header.
    I made it that way on purpose so that version 2.0 (when I write it) will be able to detect whether it's loading a 1.0 address book, a 1.1 address book (both of which use the same format but with a diferent header) or a 2.0 address book, into which a Telephone Number field will be added (amongst others - e-mail address, for example).

    Hope some of you find it useful to look at the code and see what code is doing what exactly. Any questions about the code of it, just ask!

    If you've got any comments, improvements or optimisations, then also please do let me know!

    For example, there is an

    open "filename" for random as #1

    command, which i don't use, but I think it allows random access (reading and writing, at any point in the file...) but I don't know how to use it (yet!).
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  3. #3
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,785
    Thanks,
    i can't look at it til late tonight, but thanks. sound like it might have some info ive been looking for.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  4. #4
    Senior Member
    Join Date
    Oct 2001
    Posts
    677
    Well, I wrote it in the hope it'd help someone, though until I read the AntiOnline newsletter, I didn't think anyone still used QBASIC even as a hobby!!!
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  5. #5
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,785
    i don't use qbasic anymore, i use first basic from power basic alot, its almost the same, it compiles and linls and its shareware that dosn't expire. i like to use c but i know basic better, its easier and makes a smaller file, like when i have to change passwords in ftp scripts in 200 location i just tell them a files coming, and attach it to an email (47k) it dosn't require any runtime files, on a PC platform its very portable. i should really do these things in wsh but everyone dosn't have the engine installed.
    thanks again for the code, it was very well done. Im having a problem converting it to 1stbasic because od the eof$, 1stbasic keeps telling me '= variable expected', i quess because the file isn't opened yet? if you have any suggestion please let me know. Thats the info ive been looking for, i cant loop through an array until i find out how to use EOF. !EOF dosn't work...nothing i've tryed does.

    oh yeah! do you know how to use 'command$' for taking command line aguments?
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  6. #6
    Senior Member
    Join Date
    Oct 2001
    Posts
    677
    I'm not sure if QBASIC has a command$, but I'll look into it.

    As for the eof$ its just a string variable, it shouldn't matter if a file is open yet or not, try renaming every occurrance of eof$ to something else and it should work!
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Posts
    4,785
    thanks! ill giver a go
    in vb eof is reserved for 'end of file' so i never thought it could be a variable.
    Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”

  8. #8
    Senior Member
    Join Date
    Oct 2001
    Posts
    677
    Well, I know that it commonly refers to "End Of File" (and that some languages treat it as a reserved word because it is used as such, but QBASIC does not, so I use it to store the string that is to be found at the end of the data file, so that I can compare the latest input from a file with that to see if I've reached the end of the file, since i could use the QBASIC function that allows you to check for the end of a file, but it's alwas out by one either way (either it reads 1 line more than there actually is, and crashes, or reads 1 line too few and misses the last data out) That's why I structure my data files with a start and end "tag", and for convenience, and because it's fairly recognisable, I use a HTML style "tag":

    <Program Name>

    ...
    ...
    ...

    </Program Name>

    And the eof$ = "</Program Name>" is just to store the value of the end tag so that I can compare it each time with the input that's just been read from the file, and see if I've reached the end of the file without relying on QBASICs EOF function which seeps to have a fencepost error somewhere along the way!!
    One Ring to rule them all, One Ring to find them.
    One Ring to bring them all and in the darkness bind them.
    (The Lord Of The Rings)
    http://www.bytekill.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •