最初始的code
WriteLine(FILE *pFile, const char *szOut, const char *szFmt)
{
char szTempBuf[4096];
memset(szTempBuf, 0x00, sizeof(szTempBuf));
wsprintf(szTempBuf, szOut, szFmt );
fwrite(szTempBuf, strlen(szTempBuf), 1, pFile);
}
把 char szTempBuf[4096]; 改成 TCHAR szTempBuf[4096] 之后,szOut和fwrite又报错,怎么办?经大侠指点改为以下之后:你的编译环境是unicodeCClientDC cclientDC(this);
TCHAR s[20];
wsprintf(s,TEXT("X=%d Y=%d"),POINT.x,POINT.y); //这里说我error2275: 'POINT' : illegal use of this type as an expression
cclientDC.TextOut(20,20,(CString)s);
WriteLine(FILE *pFile, const char *szOut, const char *szFmt)
{
char szTempBuf[4096];
memset(szTempBuf, 0x00, sizeof(szTempBuf));
wsprintf(szTempBuf, szOut, szFmt );
fwrite(szTempBuf, strlen(szTempBuf), 1, pFile);
}
把 char szTempBuf[4096]; 改成 TCHAR szTempBuf[4096] 之后,szOut和fwrite又报错,怎么办?经大侠指点改为以下之后:你的编译环境是unicodeCClientDC cclientDC(this);
TCHAR s[20];
wsprintf(s,TEXT("X=%d Y=%d"),POINT.x,POINT.y); //这里说我error2275: 'POINT' : illegal use of this type as an expression
cclientDC.TextOut(20,20,(CString)s);
{
int x;
int y;
};
能这么用吗?POINT.x,POINT.y至少也该是
POINT point;
point.x
point.y
{
CClientDC cclientDC(this);
TCHAR s[4096];
POINT point;
wsprintf(s,TEXT("X=%d Y=%d"),point.x,point.y);
cclientDC.TextOut(4096,4096,(CString)s);
memset(s, 0x00, sizeof(s));
fwrite(s, strlen(const char *)s, 1, pFile);
}
改成这个之后,文件内没有数据?