You are here:

Qbasic, Quickbasic/Some other questions

Advertisement


Question
QUESTION: Dear Alex,
I have some general questions today. Please help me with them:

1. How do you input only 1 character from the keyboard? I need the user to input only 'Y' or 'N'

2. How do you save program as .EXE in Qbasis 1.1(the version I have). If it can't be done in this version, can you provide some links to the newer versions?

ANSWER: Hi, Shane,

For question#1, you can use this code:

PRINT "Question? [Y/N] ";

DIM answer AS STRING * 1
answer = INPUT$(1)

answer = UCASE$( answer )
IF answer = "Y" then
' if the user selected yes....
ELSEIF answer = "N" then
' if the user selected no....
ELSE
' maybe some sort of error handling or maybe make a loop that will keep going until you type either Y or N
END IF

Question#2.  Qbasic1.1 will not make executable files.  The earliest most acceptable version of QBasic to do that is QB4.5  I think this link is active http://www.geocities.com/muratelic/qb45.htm
I think one of the links on there is dead, though, so you may have to do a little trial and error to get the download to work.  Try and QBNZ link first.

I hope that answers everything, and helps you out,
Take care,
-Alex

---------- FOLLOW-UP ----------

Error Message
Error Message  
QUESTION: Hi Alex,
Both the download links worked but on clicking, the program shows an error message. I've attached a screenshot and here's what it says:
"Invalid startup directory, please check your pif file. Choose 'Close' to terminate the application."

In the README file it says that:
"So no installation is required - simply unzip to wherever you want QuickBASIC to go. You may find you need to configure paths though - the "Set Paths" command is under the "Options" menu."

Since I can't even open the program, how do I configure the paths? Please help.


Answer
Hi, Shane,
There might be a DOS shortcut in the directory (a pif file).  If there is, delete it.  Then try running the program.

If this doesn't work, it may be because you need to run this version of QuickBasic with DOSBox some other type of DOS emulation.  What operating system are you using?  I believe after Windows XP SP2, there are some major DOS incompatibilities that force you to use DOSBox or another DOS emulator.

I hope that helps, take care,
-Alex

Qbasic, Quickbasic

All Answers


Answers by Expert:


Ask Experts

Volunteer


Alex Barry

Expertise

I have been a qbasic programmer since 2000, creating games, minor libraries and various small programs. I have experience using interrupts, graphics, file input/output, the mouse cursor, and using libraries. I have also learned FreeBASIC, QB64, c/c++, python, lua, php and html.
I do not claim to be an absolute authority in any language, but I don't mind looking things up and learning with you.

Experience

I have been programming in *Basic dialects since 2000, as mentioned in my expertise. After a year of QBasic, I learned C and C++, and dabbled a little in ASM (I don't program in ASM - I literally just played around to see how things work). When QB64 and FreeBASIC were released, I played with those languages. At the time, FreeBASIC offered more functionality and I sided with that language for a while. During that time, while I was learning new languages, that I would see what scripting languages are available, where I took up python and lua. I started to notice a staleness to QB64's development (which I kept tabs on from time to time), and am now trying to be active in it's community and maybe in it's development in the future. Currently, I am only active on the QB64.net forums, but I appear on occasion on FreeBASIC.net's forums as well.

Education/Credentials
Highschool - 2007

©2012 About.com, a part of The New York Times Company. All rights reserved.