Hex editing a file...?

So, I'm a complete-ish beginner.

I wanted to know: How would I edit the hex of a file that I opened by dragging it over onto the program? I know where the address is in the file, and what I want to change it too.

I remember reading a site forever ago that said dragging and opening a file with the program saves it as argv[1] or something like that...?

Either way, I just want to edit the file at specific locations that I already know.

Thx for helping a complete beginner!
Use this code to figure out the behavior of drag and drop.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <limits>

int main(int argc, char* argv[])
{
    for(int i = 0; i < argc; i++)
    {
        std::cout << "argv[" << i << "] = " << argv[i] << '\n';
    }

    std::cout << "Press Enter to continue...\n";
    std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
    return 0;
}


Something to watch out for, if you create a shortcut to your exe you can redefine the target of the shortcut (and you can append cmd line arguments here). If you do this, then you drag and drop a file onto your exe, the file path is added to the end of the list of arguments, not at argv[1].

So if I do this...
"C:\Users\path\to\my\stuff\argsTest.exe" -aThing -17
in the "Target" field of a shortcut I made to argsTest.exe, then drag a file on top of the shortcut, the path to the file will be put in argv[3].
Topic archived. No new replies allowed.