㈠ c語言寫bin文件
用這幾個函數fopen,fread,fwrite,fseek。FILE *fp;char *file1="文件名";unsigned char s[2];
unsigned char tem[2];fp = fopen(file1,"rb");//讀寫方式打開二進制文件
//fseek(fp,0, SEEK_CUR);
fread(s,2,1,fp);//讀取2個位元組專
fclose(fp);
tem[0]=s[1];//交換屬
tem[1]=s[0];
fp = fopen(file1,"rb+");
fseek(fp,0, SEEK_CUR);//當前位置第一個位元組
fwrite(tem,2,1,fp);
fclose(fp);