C++ Current Directory
Hey
How do I get the current directory I'm working in, in C++? I've seen a function called getcurdir() or something like that, which is found in dir.h. I've using Visual Stuio 6 and there is no dir.h?
Is there another way to get it?
Thanks
just use GetModuleFileName from the win32 API
something like:
char lpFilename[255];
memset( lpFilename, 0, 255 );
GetModuleFileName( AfxGetInstanceHandle(),lpFilename, MAX_PATH );
should do it.
something like:
char lpFilename[255];
memset( lpFilename, 0, 255 );
GetModuleFileName( AfxGetInstanceHandle(),lpFilename, MAX_PATH );
should do it.
Thanks
-----
a2ps
Do I have to include anything to use those functions?
------
Anonymous Poster
It says in the reference that direct.h includes dir.h. I don't have dir.h though?
-----
a2ps
Do I have to include anything to use those functions?
------
Anonymous Poster
It says in the reference that direct.h includes dir.h. I don't have dir.h though?
What about "GetCurrentDirectory"?
I've used that some times to get my app's directory and it worked well. AFAIK, the function doesn't bring any dependencies other than "windows.h".
I've used that some times to get my app's directory and it worked well. AFAIK, the function doesn't bring any dependencies other than "windows.h".
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement