#include #include FILE *fp, *fq, *fr; main(int argc,char **argv){ int i, d, ct, debug=0, mtr=0, address=0; unsigned char ss, st[20], mix[120]; long ctr; st[16]=0; debug = 1; if( argc != 2 ){ printf("\n... target file name missing (;_;) ...\n\n"); exit(1); } if( (fp=fopen( argv[1], "rb" )) == NULL ){ printf("\n... target file [ %s ] is not found (;_;) ...\n\n", argv[1]); exit(1); } while( (d = fgetc(fp)) >= 0 ){ if(( address == 0x17 ) && ( d != 0xFF )){ printf("\n... ID NAGASM missing (;_;) ...\n\n"); fclose(fp); exit(1); } else if(( address == 0x18 ) && ( d != 0x02 )){ printf("\n... ID NAGASM missing (;_;) ...\n\n"); fclose(fp); exit(1); } address++; } fclose(fp); address=0; fq=fopen( argv[1], "rb" ); strcpy( st, "nagasm.txt" ); fr=fopen( st, "wb" ); while( (d = fgetc(fq)) >= 0 ){ if(( address > 25 ) && ( address < 36 )){ fputc(d,fr); } else if(( address > 36 ) && ( address < 137 )){ fputc(d,fr); } address++; } fputc(0x20,fr); fclose(fq); fclose(fr); exit(0); }