home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk1.iso
/
altsrc
/
articles
/
11296
< prev
next >
Wrap
Text File
|
1994-10-04
|
2KB
|
61 lines
Path: wupost!news.utdallas.edu!corpgate!bcarh8ac.bnr.ca!bcarh189.bnr.ca!nott!torn!howland.reston.ans.net!europa.eng.gtefsd.com!uhog.mit.edu!news.mtholyoke.edu!news.umass.edu!news2.near.net!news.delphi.com!usenet
From: agony@delphi.com
Newsgroups: alt.sources
Subject: Can anyone help me on this?
Date: Mon, 3 Oct 94 20:59:31 -0500
Organization: Delphi (info@delphi.com email, 800-695-4005 voice)
Lines: 50
Message-ID: <J84Uh6L.agony@delphi.com>
NNTP-Posting-Host: bos1e.delphi.com
Ok, this question is about communications with C++, I have figured out how to
use bioscom and have written the VERY simple terminal program shown below.
The problem I am having is that bioscom() is extremely slow and I can't do much
with it, from looking at other sources I have seen functions like inport(),
inpo inportb(), outport(), and outportb() which I assume can do basically the
same thing as I am doing with bioscom().
Well, anyone who knows C++ can they look at the following code and tell me how
I would use another function to accomplish the same task?:
#include <bios.h>
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int port;
void main(void)
{
int ch, i, ok=1, x, y;
char s[81];
printf("\nCom port: ");
gets(s);
port=atoi(s);
port--; // bioscom takes 0 for com1, 1 for com2, ect.
clrscr();
while(ok) // Loop until !ok (when Alt-X pressed)
{
while(bioskey(1)==0) // Check com port until key pressed
{
ch=bioscom(_COM_RECEIVE,0,port); // Get 'ch' from 'port'
if(ch!=-8192) // Value being received when not receiving anything
printf("%c",ch);
}
ch=bioskey(0); // Get key that was pressed
if(ch==11520) // If key pressed == Alt-X, then exit
ok=0;
else
bioscom(_COM_SEND,ch,port); // Send 'ch' over 'port'
}
I am not sure how well that ASCII UL worked, but I assume you can get the
idea... any help would be greatly appreciated.