안녕하세요.
Borland C++의 Help에 나오는 예제인데, 컴파일 해보면,
Cannot conver 'void *' to 'int *' in function main()
Call to undefined function 'bioscom' in function main()..
Call to undefined function 'cprintf' in function main()..
이런 에러가 나옵니다.
분명히 include 되있는데 왜 안되죠?
Turbo C++를 설치해서 해봐도 똑같네요..
OS는 WinXP Pro입니다.
조언 부탁드립니다.
-----------------------------------------------------------
/* bioscom example */
/*
This example can be used to communicate between
two PCs via a null modem cable.
The example is specific to COM1. The appropriate values
for COM2 are included in this example for the convenience
of switching the code to work with COM2.
*/
#include <bios.h>
#include <conio.h>
#include <dos.h>
#define DTR 0x01 // Data Terminal Ready
#define RTS 0x02 // Ready To Send
#define COM1PORT 0x0000 // Pointer to Location of COM1 port
#define COM2PORT 0x0002 // Pointer to Location of COM2 port
#define COM1 0
#define COM2 1
#define DATA_READY 0x100
#define FALSE 0
#define TRUE !FALSE
#define SETTINGS ( 0xE0 | 0x00 | 0x02 | 0x00) // 9600,N,7,1
int main( void )
{
int in,
out,
status,
DONE = FALSE,
far *RS232_Addr;
/* Determine port location of COM1.
0x40:0x00 = COM1 I/O port address
0x40:0x02 = COM2 I/O port address
*/
RS232_Addr = MK_FP( 0x0040, COM1PORT );
if( !*RS232_Addr )
return -1;
bioscom( 0, SETTINGS, COM1 );
cprintf( "... BIOSCOM [ESC] to exit ...\n" );
while( !DONE )
{
/* Reset DTR and RTS to prepare for send/receive of
next character.
*/
outportb( *RS232_Addr + 4, DTR | RTS );
/* Get status of com port.
*/
status = bioscom( 3, 0, COM1 );
if( status & DATA_READY )
/* There's a character on the port. Get it and echo.
*/
if( (out = bioscom( 2, 0, COM1 ) & 0x7F) != 0 )
putch( out );
if( kbhit() )
/* Key has been struck. Get it and send to port.
*/
if( (in = getch()) == '\x1B' )
/* User pressed ESCAPE. Don't send to port.
*/
DONE = TRUE;
else
/* Send character to com port.
*/
bioscom( 1, in, COM1 );
}
return 0;
}
|