LPCTSTR is only a pointer which point to the temp string,
COptions::StoragePath+_T("\\test\\")+pWData-cFileName; will construct
a temp CString ,but after that it will be destroyed, and the pointer
will point to a invalid memory.
by the way, please do not post Chinese charator in your question, here
is a international mailist, so many people can not read in Chinese.
On Jul 31, 11:16 am, "Jason .Y" <lin.yang.ja...@gmail.comwrote:
Quote:
Hi~I'm planning to make a smiple program to upload file,but I've
traped by a strange problem,here is a chip of my program:
===========================================
LPCTSTR lpszMyFilePath =COptions::StoragePath+_T("\\test\\")+pWData-
>
>
LPCTSTR lpszPeerFilePath = pWData->cFileName;
>
UINT nMyTaskID = 0;
>
nMyTaskID = WRMCC_RequestUploadFile (/*_T("\\´æ´¢¿¨\\test\
\20080618.dat")*/lpszMyFilePath,lpszPeerFilePath, FTNOTIFY_Callback );
>
==============
When I was using _T("\\´æ´¢¿¨\\test\\20080618.dat") as LParm,the program
work successfully.but when I use lpszMyFilePath,which i defined myself
above,the server said "File not exist"
>
P.S.
COptions::StoragePath is a instance of CString
>
cFileName is a name of TCHAR[ ] array
>
and the type of upload function is:
UINT WRMCC_RequestUploadFile ( LPCTSTR lpszMyFilePath, LPCTSTR
lpszPeerFilePath=NULL, FUNC_FTNOTIFY_Callback
Proc_FTNOTIFY_Callback=NULL, BOOL bForceRetransmit=FALSE );