2

I am trying to append a char to the end of a char array:

char szBuffer[MAX_PATH];
if(SHGetSpecialFolderPathA(HWND_DESKTOP, szBuffer, CSIDL_PERSONAL, FALSE)){
    szBuffer[sizeof(szBuffer)] = "\\";
}

I know that will not work correctly, but I am unsure how to do it. Also, how would I append a string?

4

1 回答 1

2

You can use strcat, like this:

strcat(zsBuffer, "\\");

This assumes that MAX_PATH has enough space to fit the string with the appended character.

于 2012-11-10T02:14:40.710 回答