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.
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].