Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)
- // assumes
- // company is a pointer to a character sting containing company name
- // appname is a pointer to a character string containing application name
- // fname is a pointer to a character string cintaining name of file to be created
- #include <shlobj.h> // for SHGetFolderPath
- #include <direct.h> // for _mkdir
- char path[MAX_PATH];
- SHGetFolderPath(NULL,CSIDL_COMMON_APPDATA,NULL,NULL,path);
- strcat(path,"/");
- strcat(path,company);
- _mkdir(path);
- strcat(path,"/");
- strcat(path,appname);
- _mkdir(path);
- strcat(path,"/");
- strcat(path,fname);
- // path is now a character string which can passed to fopen
Add Comment
Please, Sign In to add comment