bt ngắt
1. Tạo một tệp với tên tệp và nội dung nhập từ bàn phím
#include <dos.h>
#include <string.h>
#include <stdio.h>
void main()
{ union REGS v,r; struct SREGS s;
char *tt;
printf("Nhap ten tep can tao:"); fflush(stdin);gets(tt);
s.ds=FP_SEG(tt);
v.x.dx=FP_OFF(tt);
v.h.ah=0x3c;
v.x.cx=0; // ko co thuoc tinh
int86x(0x21,&v,&r,&s);
}
2. Xóa một tệp với tên tệp nhạp từ bàn phím
#include <dos.h>
#include <string.h>
#include <stdio.h>
void main()
{ union REGS v,r; struct SREGS s;
char *tt;
printf("Nhap ten tep can xoa:"); fflush(stdin); gets(tt);
s.ds=FP_SEG(tt);
v.x.dx=FP_OFF(tt);
v.h.ah=0x41;
int86x(0x21,&v,&r,&s);
}
3. Đổi tên tệp: tên tệp cũ và tên tệp mới nhập từ bàn phím
#include <dos.h>
#include <string.h>
#include <stdio.h>
void main()
{ union REGS v,r; struct SREGS s;
char *tc;tm;
printf("Nhap ten tep can tao:"); fflush(stdin); gets(tt);
s.ds=FP_SEG(tc);
v.x.dx=FP_OFF(tc);
s.es=FP_SEG(tm);
v.x.di=FP_OFF(tm);
v.h.ah=0x56;
int86x(0x21,&v,&r,&s);
}
4. Đổi thuộc tính một tệp với tên tệp nhạp từ bàn phím
#include <dos.h>
#include <string.h>
#include <stdio.h>
void main()
{ union REGS v,r; struct SREGS s;
char *tt; int att;
printf("Nhap ten tep: "); fflush(stdin); gets(tt);
cprintf("Nhap thuoc tinh tep :"); scanf(“%d”, &att);
s.ds=FP_SEG(tt);
v.x.dx=FP_OFF(tt);
v.h.ah=0x43;
v.h.al=1;
v.x.cx=att;
int86x(0x21,&v,&r,&s);
}
5. Đọc thuộc tính một tệp với tên tệp nhạp từ bàn phím
#include <dos.h>
#include <string.h>
#include <stdio.h>
void main()
{ union REGS v,r; struct SREGS s;
char *tt;
printf("Nhap ten tep: "); fflush(stdin); gets(tt);
s.ds=FP_SEG(tt);
v.x.dx=FP_OFF(tt);
v.h.ah=0x43;
v.h.al=0;
int86x(0x21,&v,&r,&s);
printf(“
Thuoc tinh tep:%d“,r.x.cx);
getch();
}
Bạn đang đọc truyện trên: AzTruyen.Top