TE Comp Sem-I MMC Prac 8 (PC2PC Chat)

#include<stdio.h>
#include<dos.h>
#include<string.h>
#include<conio.h>

#define PORT1 0x3f8

void main()
{
int c,ch,choice,i;

char name[30],buf;
char send[5]={'A','M','I','T',':'};
FILE *in,*out;
clrscr();
outportb(PORT1+0,0x03);
outportb(PORT1+1,0x00);
outportb(PORT1+3,0x03);
outportb(PORT1+2,0xc7);
outportb(PORT1+4,0x0b);
//outportb(PORT1,'A');
while(1)
{
c=inportb(PORT1+5);
if(c&1)
    {

          buf=inportb(PORT1);
          printf("%c",buf);
    }
else
{
    if(kbhit())
     {
    for(i=0;i<5;i++)
    outportb(PORT1,send[i]);
    gets(name);
    for(i=0;i<=strlen(name);i++)
    {
       outportb(PORT1,name[i]);
        delay(10);
    }
      }
}
}
getch();
}

No comments:

Post a Comment