#include #include #include #include int main(int argc, char *argv[]){ if (argc != 4){ fprintf(stderr, "%c <32-bit in Hex> ", argv[0]); exit(1); } off_t offset; ssize_t nb_write; int nb, n; int fdin; fdin = open(argv[1],O_WRONLY); if (fdin == -1){ perror("File can't be opened"); exit(2); } offset = (off_t) strtol (argv[3], NULL, 16); nb = (int) strtol(argv[2], NULL, 16); n = lseek(fdin, offset * sizeof(int), SEEK_SET); nb_write=write(fdin, &nb, sizeof(int)); printf("%x", nb); return EXIT_SUCCESS; }