Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <direct.h>
- char current_work_dir[FILENAME_MAX];
- _getcwd(current_work_dir, sizeof(current_work_dir));
- #include <windows.h>
- #include <tchar.h>
- LPTSTR ExtractFilePath(LPCTSTR FileName, LPTSTR buf)
- {
- int i, len = lstrlen(FileName);
- for(i=len-1; i>=0; i--)
- {
- if(FileName[i] == _T('\'))
- break;
- }
- lstrcpyn(buf, FileName, i+2);
- return buf;
- }
- // szFileName - содержит путь к exe-файлу
- // szPath - содержит путь к папке, в которой находится exe-файл
- TCHAR szFileName[MAX_PATH], szPath[MAX_PATH];
- GetModuleFileName(0, szFileName, MAX_PATH);
- ExtractFilePath(szFileName, szPath);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement