Connecting Tech Pros Worldwide Help | Site Map

Some question about CString,Unicode,and TCHAR *

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 31st, 2008, 03:25 AM
Jason .Y
Guest
 
Posts: n/a
Default Some question about CString,Unicode,and TCHAR *

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, 05:05 AM
Ian Collins
Guest
 
Posts: n/a
Default 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, 05:15 AM
cooleaf
Guest
 
Posts: n/a
Default 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, 05:55 AM
Jason .Y
Guest
 
Posts: n/a
Default 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.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.