Đây là hàm mình nhập và lưu vào file, còn muốn xóa 1 phần tử theo maPL của nó thì như nào ạ?.
typedef struct {
char maPL[10];
char tenLoai[20];
}phanLoai;
void nhapPL(){
FILE *fpl;
phanLoai pl;
int d;
fpl = fopen("phanLoai.dat", "ab");
fseek(fpl, 0, 2);
d = ftell(fpl)/sizeof(phanLoai)+1;
fflush(stdin);
printf("Nhap ds phan loai thu %d: ", d++);
printf("\nNhap ma phan loai: "); gets(pl.maPL);
printf("Nhap ten loai: "); gets(pl.tenLoai);
fwrite(&pl, sizeof(phanLoai), 1, fpl);
printf("\nNhap bat ki de tiep tuc");
getch();
fclose(fpl);
}
int main(){
nhapPL();
}