Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <shlobj.h>
- int main(int argc, char *argv[])
- {
- const char *szFileName = "text.txt";
- const char *szContent = "test string";
- char szPath[_MAX_PATH];
- SHGetSpecialFolderPath(NULL, szPath, CSIDL_DESKTOPDIRECTORY, FALSE);
- strcat(szPath, "\\");
- strcat(szPath, szFileName);
- FILE *pFile = fopen(szPath, "a+");
- if(pFile != NULL)
- {
- fputs(szContent, pFile);
- fclose(pFile);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement