I cant figure out how to make this damn code work.
Its objective is simple: the user selects a file, type the offset and then the hex value he wants to be put in that specifit offset. This is what i came up with so far:

Code:
#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main()
{
    string fileName;
    int offset;
    string hexValue;

    cout<<"FILE: ";
    cin>>fileName;

    fstream myFile(fileName);

    if(myFile.is_open())
    {
        cout<<"OFFSET: ";
        cin>>offset;

        cout<<"HEX VALUE TO BE WRITTEN: ";
        cin>>hexValue;

        myFile.seekp(offset);
        myFile.write(hexValue,1);
    }
    else
    cout<<"Couldn't open file!"<<endl;

    return 0;
}