Step 1 is look at argv[0]
Code:
int main ( int argc, char *argv[] ) {
cout << argv[0] << endl;
}
This should be something like C:\foo\bar\prog.exe
In which case, you strip off the trailing pathname (giving C:\foo\bar\) and you append image.jpg
Step 2 is to look at the PATH environment variable
Code:
int main ( int argc, char *argv[] ) {
char *env = getenv("PATH");
if ( env ) {
cout << env << endl;
}
}
This is a series of paths like C:\foo;C:\bar
Parse this to extract each path in turn, then test to see if C:\foo\image.jpg and C:\foo\prog.exe exist.
When you find it, you have your answer.