home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / HEXUTIL.ZIP / HEXUTIL.CPP < prev    next >
C/C++ Source or Header  |  1994-01-14  |  665b  |  26 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <iostream.h>
  4. #pragma argsused
  5.  
  6. void main( int argc, char *argv[] )
  7. {
  8. int fart = atoi(argv[3]);
  9. unsigned long die = atol(argv[2]);
  10. if (argv[1] == NULL)
  11. {cout <<"No File Name!\n";exit(1);}
  12. if(argv[2] == NULL)
  13. {cout << "No offset specified, or invalid offset specified!";exit(1);}
  14. if(argv[3] == NULL)
  15. {cout << "No character specified!";exit(1);}
  16. if((fart > 255) || (fart < 0))
  17. {cout <<"Invalid character number";exit(1);}
  18. FILE *stream;
  19. if ((stream = fopen(argv[1], "r+b"))== NULL)
  20. {cout<<"Error opening target file";
  21. exit(1);}
  22. fseek(stream,die,0);
  23. fprintf(stream, "%c", fart);
  24. fclose(stream);}
  25.  
  26.