Hello guys. How can i get my file path? I konw my program's name but i don't know where it will be put. How can i get file path during program's execution?
Thank you

Try a WinAPI call to GetModuleFileName()

If you're using windows, try:

#include <windows.h>
#include <iostream>
using namespace std;

int main() {
  char szFileName[MAX_PATH];
  HINSTANCE hInstance = GetModuleHandle(NULL);
  GetModuleFileName(hInstance, szFileName, MAX_PATH);
  cout << szFileName;
  cin.ignore();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.