BBS: Inland Empire Archive Date: 03-31-92 (12:53) Number: 193 From: KEVIN NEWELL Refer#: 127 To: TRENT SHIRLEY Recvd: NO Subj: Re: Help with com routine Conf: (2) Quik_Bas
Hello Trent!
In a msg of <29 Mar 92>, Trent Shirley writes to All:
TS> I need to be able to read a text file that contains the baud rate, com
TS> port #, and basic settings for the modem, and then open the com port
TS> as a file, using that data. I dont seem to be able to use a variable
TS> to open the com port, and was hoping someone could tell me how to do
TS> this, or an alternate way to acheive the same purpose.
TS> I typically use something similar to this:
TS> Open "Com2:2400,N,8,1" for RANDOM AS #1
TS> since I want the com number and baud rate to be variable, how can I
TS> pass this info into the OPEN command line? It would also be nice to
TS> be able to set the Parity, data bits, and stop bits in the same line
TS> as well, instead of having them fixed. Right now the only way I can
TS> accomplish this is to have a BUNCH of IF statements to open the com
TS> port with.
TS> Any ideas?
Well you could do something like this
OPEN "TEXTFILE.TXT" FOR INPUT AS 1
INPUT Port$, Baud$, Parity$, DataBit$, StopBit$
CLOSE 1
OPEN Port$ + Baud$, + Parity$ + DataBit$ + StopBit$ FOR RANDOM AS #1
This would work PROVIDED that you have your Text file set up as...
COM2:
2400
N
8
1
You can get more involved with this and check each variable
for completeness and change it to the proper syntax...
Chat Later!
Kevin
--- GoldED 2.31p
* Origin: --> Treasure Island {309} 346-2074 @14.4 *HST/V42b* (1:232/200)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET