Hi , ppl,

I want to get the absolute file path of my c++ app,

I tried searching through io.h, but alas , I don't know what the function is.:sad:

I am using Dev C++ under Windows.


Thanks a lot,

Ishwar

try argv[0]

int main(int argc, char *argv[])
{
  printf("%s\n", argv[0]);
  return 0;
}
int main(int argc, char *argv[])
{
   printf("%s\n", argv[0]);
   return 0;
}

Cool , that works in a dos box,

but i am making a windows app , and
the program's main entry point is something like this:

/*  Declare Windows procedure  */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

Thanks ,

Ishwar

You can either use

char filename[MAX_PATH];
    GetModuleFileName(NULL, filename, MAX_PATH);

or
the command line passed to WinMain

int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev_instance, char* command_line, int show_command)

Thanks ppl,

I used

GetModuleFileName(NULL, filename, MAX_PATH);

,

and it works now

Ishwar