patch_nstep.c 363 B

1234567891011121314151617181920
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. FILE * fp;
  4. int nstep;
  5. int ostep;
  6. int main(int argc, char *argv[])
  7. {
  8. nstep = atoi(argv[2]);
  9. fp = fopen(argv[1],"r+");
  10. fseek(fp,28,0);
  11. fread(&ostep,4,1,fp);
  12. fseek(fp,28,0);
  13. fwrite(&nstep,4,1,fp);
  14. fclose(fp);
  15. printf("\nNSTEP changed from %d to %d in file <%s>\n",ostep,nstep,argv[1]);
  16. return 0;
  17. }