Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I get mu qbasic script to acceps a external value

Status
Not open for further replies.

lpb71

Technical User
Mar 10, 2004
57
0
0
GB
I have written a qbasic script that will edit an ip address within a file depending on what value the script is run with. I can't get my script to accept an external value - ie c:\vlan.exe 10. sample of script below. (In example I want 10 to be passed to my script as the value for vlan$).

LET vlan1$ = "10 10 " + vlan$ + " 1"
LET vlan2$ = "10 10 " + vlan$ + " 8"
'OPEN "c:\SCRIPTS\PROTOCOL.UPD" FOR INPUT AS #2
OPEN "i", 2, "c:\SCRIPTS\PROTOCOL.UPD"
OPEN "o", 3, "c:\SCRIPTS\PROTOCOL.CHG"
WHILE NOT EOF(2)
LINE INPUT #2, a$
IF a$ <> "DefaultGateway0=changeme" THEN PRINT #3, a$
IF a$ = "DefaultGateway0=changeme" THEN PRINT #3, "DefaultGateway0="; vlan1$
WEND
 
Done this by getting my script to read an unput file.
 
Note to all:

Noone uses Let anymore. It's only included to be backward
compatible.

Let A=1
is exactly the same as
A=1
and 4 less bytes when saved in ascii file format
 
LOL...

I was about to say...

Do you REALLY still use LET ???

That was only carried over for compatability reasons from gwbasic...
(That's like using line numbers... Please say you don't do that ;-))

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
It's easier for a beginner to understant what "LET" let you do, and it can be useful when you want to search your code for variable change and not for comparison, but you're right it takes too much place for something not necessary at all. I used to take "LET" on the TRS80, and it's a good things it is not necessary anymore!

SkyFighter
skyfighta@hotmail.com
Get the fun out of life!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top