I wrote a hex viewer with the following code
What do I do so I can actually EDIT the info?Code:#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
int main(int argc, char *argv[])
{
struct stat fbuf;
FILE *dump;
int i;
int x = 0;
unsigned int size;
if(argc<2)
{
puts("Format: HEXDUMP filename");
exit(0);
}
dump = fopen(argv[1],"rb");
if(dump == NULL)
{
printf("Error opening %s.",argv[1]);
exit(0);
}
size = stat(argv[1],&fbuf);
size = fbuf.st_size;
while(i=fgetc(dump), size != 0)
{
printf("%0.2X ",i);
x++;
size--;
if(!(x%16))
{
putchar('\n');
}
}
fclose(dump);
return(0);
}
