Connecting Tech Pros Worldwide Help | Site Map

Some question about CString,Unicode,and TCHAR *

  #1  
Old July 31st, 2008, 04:25 AM
Jason .Y
Guest
 
Posts: n/a
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-
Quote:
>cFileName;
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 );
  #2  
Old July 31st, 2008, 06:05 AM
Ian Collins
Guest
 
Posts: n/a

re: Some question about CString,Unicode,and TCHAR *


Jason .Y wrote:

[lots of windows stuff]

Try a windows group, this isn't standard C++.

--
Ian Collins.
  #3  
Old July 31st, 2008, 06:15 AM
cooleaf
Guest
 
Posts: n/a

re: Some question about CString,Unicode,and TCHAR *


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-
>
Quote:
cFileName;
>
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 );
  #4  
Old July 31st, 2008, 06:55 AM
Jason .Y
Guest
 
Posts: n/a

re: Some question about CString,Unicode,and TCHAR *


On Jul 31, 1:05 pm, cooleaf <cool...@gmail.comwrote:
Quote:
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-
>
Quote:
Quote:
>cFileName;
>
Quote:
LPCTSTR lpszPeerFilePath = pWData->cFileName;
>
Quote:
UINT nMyTaskID = 0;
>
Quote:
nMyTaskID = WRMCC_RequestUploadFile (/*_T("\\´æ´¢¿¨\\test\
\20080618.dat")*/lpszMyFilePath,lpszPeerFilePath, FTNOTIFY_Callback );
>
Quote:
==============
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"
>
Quote:
P.S.
COptions::StoragePath is a instance of CString
>
Quote:
cFileName is a name of TCHAR[ ] array
>
Quote:
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 );- Hide quoted text -
>
- Show quoted text -
I'm sorry for my ruleless post,and thank you very much for your
assistance.
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
What to prefer - TCHAR arrays, std::string or std::wstring ? rohitpatel9999@yahoo.com answers 14 August 3rd, 2006 07:35 PM