一:CString转成char*和文件写
FILE *fp;
CString command("good1234");
if((fp = fopen("c://secret.txt", "w")) == 0)
{
printf("open failed!");
exit(1);
}
char* buffer=(LPSTR)(LPCTSTR)command;
fwrite(buffer, 1, strlen(buffer), fp);
fclose(fp);
二:如何取得进程所在的文件路径
CMarkup xml;
char HistoryName[260];
char *tmp;
memset(HistoryName,0,sizeof(HistoryName));
GetModuleFileName (NULL, HistoryName, sizeof(HistoryName));
tmp = strrchr (HistoryName, '\\');
*(tmp + 1) = 0;
strcpy (++tmp, "History.xml");
bLoadXml = xml.Load(HistoryName);