'Faking' input to QBasic program with VB .NET 2005 application

D

Danielle

All -

I was asked to work on a project converting some weather data. The
program used to convert the data is written in Quick Basic. I am only a
novice programmer and while I can see from the .BAS file what is
happening, I don't have the time bandwidth to rewrite the program in VB
..NET and I'm not sure it would do a proper conversion even if I did.

The compiled QB program asks for three inputs... 1) source file
location (string), 2) interval for averaging (int) and 3) output
location (string).

My question for anyone with Quick Basic experience is this - is there a
way to 'fake' this user input so that I could call the old QB program
from and 'pass' the input parameters programmatically such that the QB
program will think I'm manually responding to the prompts??

Many thanks in advance -
Danielle
 
T

Tom Leylan

Well there is a challenge one doesn't hear ever day :) QBasic...

I don't know if you can redirect the input (possibly) but a couple of
options come to mind. One is to contact the folks here:
http://www.qbasic.com/. The other is to add a few lines of code to the QB
program to accepts the inputs on the command line and to comment out the
spot where it currently requests input. You should be able to run the
program from your dotnet program and supply the values it wants on the
command line.

One other thing you could do with reasonably few changes is have the the QB
program read a text file to obtain the answers it needs (there are only 3
inputs.) The dotnet program would generate the "inputs.txt" file and run
the QB program which would read that file instead of prompting for the
answers.

In any case you might check with folks at that website.
Tom
 
C

Cor Ligthert [MVP]

Tom,

I did want to write something the same, this if you ask yourself if you
should have done that. I am often in doubt after that I have given this kind
of answers.

Cor
 
M

Michel Posseth [MCP]

To help you on your way the inputs on the command line = command$ ( the
parameters that you give while starting the program )


In my opinion this proggy could be verry easy rewritten in VB.Net or is it a
hughe code file ?


regards

Michel
 
C

Chris Dunaway

Michel said:
To help you on your way the inputs on the command line = command$ ( the
parameters that you give while starting the program )


In my opinion this proggy could be verry easy rewritten in VB.Net or is it a
hughe code file ?

I agree with Michel that re-writing the program in VB.net should not be
too difficult however, if you don't want to do that, you can use the
Process class in .Net and re-direct the standard input and output to
your vb.Net program. Then you can supply the necessary information as
the program prompts for it. This assumes that the QBasic program uses
standard input and output.
 
D

Danielle

Thanks to all for the very helpful suggestions. I will look into the
Process class, but suspect that the Command$ input may be the way I go.


Thanks again!
Danielle
 
D

Danielle

To answer the questin about how easy it would be to rewrite - it's a
small program but the data it works on is very specific and also stored
in some sort of wacky format. I don't feel confident that I can get the
output I need, while I am sure that the old qbasic program will out put
the right stuff. So, I think the command line suggestion is in first
place now...

Danielle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top