Alright programming gurus!
I want to send a character from one PC to another via serial port.
What I need is a program in Quickbasic, that will take care of
sending and receiving one single character at a time. The same
software is sitting on both computers :sigh:.
::ears perk::
did you say quickbasic? :D
i reckon i know a bit about that language... there are two real ways to access COM ports in QB. one of which is much easier, so we'll go with that one.
i'll assume you know how to open files for access already. let me know if i'm mistaken here.
you'll want to open a COM port with this command (QB is limited to COM1 and COM2 with this method i believe)
Code:
OPEN "COM1:9600,N,8,1" FOR RANDOM AS #1
obviously, you can change 9600,N,8,1 to whatever you want for port settings.
when you want to read a byte do this:
Code:
tmpbyte$ = SPACE$(1)
GET #1, , tmpbyte$
when you want to write data, do this:
Code:
tmpdataout$ = "omg i am so leet"
PUT #1, , tmpdataout$
you should get the picture. it's fairly easy. there can be a small lag (1 second or so) during GET if there is no waiting data to grab, which is why i don't like using this method but for a chat program or whatever it's not really a problem.
remember to close the open port handle when you're finished like this:
you dont NEED to use #1 as the handle. you can do other numbers. just remember which you use for the PUT and GET commands. to have QB determine the first free file handle, use this command:
now the variable ff holds the handle value, and you can replace all "#1" with "ff"
in addition to chatting character by character, you can manage file transfers this way
EDIT: if you're having problems trying this, i have no problem loading up QB and actually writing you a sample program for it.