Sunteți pe pagina 1din 2

#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<dos.h> #include<iostream.h> #include<fstream.

h> void main() { FILE *fp; char fname[23]; union REGS a,b;//REGS is defined by <dos.h> char al; int op; clrscr(); a.h.ah=0x00;//h->BYTEREGS, ah->unsigned char a.x.dx=0;//x->WORDREGS, dx->short_upper_dx a.h.dl=0;//h->BYTEREGS, dl->unsigned char /*int int86( int inter_no,const union REGS *in_regs,union REGS *out_regs );*/ int 86(0x11,&a,&b);//function causes the computer's CPU to be interrupted with a n interrupt whose number is given by 0x11. printf("\n1.send \n2.recevie \n3.exit \n"); do { printf("Enter the option:"); scanf("%d",&op); switch(op) { case 1: printf("enter the fname:"); cin>>fname; fp=fopen(fname,"r"); if(fp=NULL) { printf("Error"); getch(); exit(0); } a.h.ah=0x01; a.x.dx=0; while(!feof(fp)) { ch=getc(fp); a.h.al=ch; int 86(0*14,&a,&b); } if(a.h.ah==0) printf("Error"); else printf("Data ready"); fclose(fp); break; case 2: fp=fopen(fname,"r"); if(fp==NULL) { printf("\nError"); getch(); exit(0); } while(!feof(fp))

{ ch=getc(fp); cout<<ch; } fclose(fp); cout<<ch; } fclose(fp); break; case 3: exit(0); break; default : printf("Enter the correct option"); } } while(op!=3) getch(); }

S-ar putea să vă placă și