If you just provide the file name, the file will be assumed to be in the current working directory. This can be obtained using the POSIX call getcwd, which turns up as _getcwd in the Microsoft CRT. There's also the WinAPI GetCurrentDirectory function which does the same job.
(On Windows you could use GetFullPathName to obtain the full path for the file, and then chop off the file name. But that would just be more work to obtain the same path as before.)
There is no automatic way of working out where a file is from its name.
You could search for the file, if you know it has a unique name. But that would be slow unless you restricted the search to a small subtree.
If you cd to the folder where the exe is (e.g. c:\test) and run it there (myapp.exe), then the current directory will be the same as the exe (c:\test). But if you cd to (e.g.) c:\test\data and then run the app like ..\myapp.exe, then the working directory will be c:\test\data, not the app folder (c:\test).
You could obtain the directory where the app is located and then set the working directory to the same value. Is this what you mean? But note that it is not best practice to store data in the same folder as the exe on Windows or Linux.