Click here to Skip to main content
15,902,032 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralPlease help me Pin
V_shr8-May-06 4:18
V_shr8-May-06 4:18 
QuestionC Structure and Function Pin
Try8-May-06 3:12
Try8-May-06 3:12 
AnswerRe: C Structure and Function Pin
Chris Losinger8-May-06 3:19
professionalChris Losinger8-May-06 3:19 
AnswerRe: C Structure and Function Pin
jhwurmbach8-May-06 3:23
jhwurmbach8-May-06 3:23 
QuestionRetrieving "My documents" folder Pin
YaronNir8-May-06 3:06
YaronNir8-May-06 3:06 
AnswerRe: Retrieving "My documents" folder Pin
Monty28-May-06 3:17
Monty28-May-06 3:17 
GeneralRe: Retrieving "My documents" folder Pin
YaronNir8-May-06 3:26
YaronNir8-May-06 3:26 
AnswerRe: Retrieving "My documents" folder Pin
jhwurmbach8-May-06 3:17
jhwurmbach8-May-06 3:17 
Its something like this:
std::string GetApplicationDataPath()
{
    std::auto_ptr<char> path( new char[MAX_PATH]);

    const HRESULT result = ::SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, path.get());

    if( result != S_OK)
        return std::string();
    else    {
        std::string s( path.get());
        if( s.at( s.size()-1) != '\\')
            s += '\\';
        return s + _T("\\MyApp\\");
    }
}


The CSIDL_APPDATA defines which of the plethora of system directories you want.
MSDN has them all.



"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."

-- Caius Petronius, Roman Consul, 66 A.D.

AnswerRe: Retrieving "My documents" folder Pin
Ganesh_T8-May-06 3:23
Ganesh_T8-May-06 3:23 
GeneralRe: Retrieving "My documents" folder Pin
YaronNir8-May-06 3:26
YaronNir8-May-06 3:26 
GeneralRe: Retrieving "My documents" folder Pin
YaronNir8-May-06 3:30
YaronNir8-May-06 3:30 
AnswerRe: Retrieving "My documents" folder Pin
Hamid_RT8-May-06 3:33
Hamid_RT8-May-06 3:33 
GeneralRe: Retrieving "My documents" folder Pin
YaronNir8-May-06 3:38
YaronNir8-May-06 3:38 
GeneralRe: Retrieving "My documents" folder Pin
Hamid_RT8-May-06 3:42
Hamid_RT8-May-06 3:42 
GeneralRe: Retrieving "My documents" folder Pin
YaronNir8-May-06 3:42
YaronNir8-May-06 3:42 
GeneralRe: Retrieving "My documents" folder Pin
Hamid_RT8-May-06 4:07
Hamid_RT8-May-06 4:07 
GeneralRe: Retrieving "My documents" folder Pin
YaronNir8-May-06 4:19
YaronNir8-May-06 4:19 
AnswerRe: Retrieving &quot;My documents&quot; folder Pin
Eric Dahlvang8-May-06 4:03
Eric Dahlvang8-May-06 4:03 
GeneralRe: Retrieving "My documents" folder Pin
YaronNir8-May-06 4:19
YaronNir8-May-06 4:19 
QuestionCString to char* Pin
big_denny_2008-May-06 3:05
big_denny_2008-May-06 3:05 
AnswerRe: CString to char* Pin
Try8-May-06 3:14
Try8-May-06 3:14 
AnswerRe: CString to char* Pin
Monty28-May-06 3:14
Monty28-May-06 3:14 
AnswerRe: CString to char* Pin
Hamid_RT8-May-06 3:27
Hamid_RT8-May-06 3:27 
GeneralRe: CString to char* Pin
Russell'8-May-06 3:28
Russell'8-May-06 3:28 
GeneralRe: CString to char* Pin
Monty28-May-06 3:30
Monty28-May-06 3:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.