Ok i am trying to make a program that reads every nth byte in hex from a binary file and adding a number to the hex to get a diffrent char.
example I want to edit every 10 bytes. the first 10th byte i read in binary is 010000001, which in ascii it is character A which is 41 in hex and i want to add 1 to the hex to get a 42 in hex, which is B in ascii...
The overall program i am trying to make is a file corruptor that edits every nth byte of a binary. My psuedocode is:
while(!eof)
{
for(int count =0; cout < (nythbyte -1);count++)
{ read and write byte in to output file}
read byte as ascii and write to output
}
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <stdio.h>
#include <cstring>
#include <fstream>
#include <string>
#include <cstdio>
usingnamespace std;
int main()
{
int nthByte = 0;
char byte = ' ';
FILE *in
fstream outfile;
fstream infile;
infile.open("smb3.nes", ios::in|ios::binary);
outfile.open("o.nes", ios::in|ios::out|ios::binary|ios::ate|ios::trunc); //open file in binary, in out mode, plan on reading and editing the outfile later in the program, also if exist delete and start over
while(!outfile.eof())
{
for(int count =0; count < (nthByte -1);count++)
{ getc(infile); putc(outfile);}
}
}