473,383 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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-
>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 );
Jul 31 '08 #1
3 2975
Jason .Y wrote:

[lots of windows stuff]

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

--
Ian Collins.
Jul 31 '08 #2
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:
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-
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 );
Jul 31 '08 #3
On Jul 31, 1:05 pm, cooleaf <cool...@gmail.comwrote:
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:
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-
>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 );- Hide quoted text -

- Show quoted text -
I'm sorry for my ruleless post,and thank you very much for your
assistance.
Jul 31 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Markus Hämmerli | last post by:
I ' ll tra to convert a Cstring to char* without success. I working in a Unicode enabled environment this is working in Unicode CString source = _T("TestString"); TCHAR *szSource =...
0
by: Chris | last post by:
Hi all, Just converted our 95 project workspace file from VC++ 6.0 to .NET, and things have gone...um...pretty well. Down to the last of the suffering - our main server application is doing...
5
by: Sonu | last post by:
Hello everyone and thanks in advance. I have a multilingual application which has been built in MFC VC++ 6.0 (non-Unicode). It support English German Hungarian so far, which has been fine. But...
4
by: Burt Johnson | last post by:
I have a CString with a numeric string in it. In the past, I would use atoi( ) to convert to an int. That doesn't work with Unicode though. What is the proper Unicode method for converting a...
1
by: Michael Buechel | last post by:
Hi NG, I've copied this from the article Q309801 (http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B309801). ---- schnipp --------- You may receive an LNK2019 error message when you...
4
by: sreenubkaimal | last post by:
Please help me with this.. I have a DLL created in Visual C++ 6.0 ( VS 6.0 ). I am trying to use this DLL in a new wrapper application written using Visual Studio .net 2003 (C++ - MFC). My...
3
by: MIUSS | last post by:
Hello everyone! I got a problem with creating new line... I tried this: lstrcpy(NewLineIdr, TEXT("\r\n")); I already tried this: NewLineIdr = 0x000D; NewLineIdr = 0x000A;...
16
by: Norman Diamond | last post by:
In an antique obsolete version of MFC, a CString expression could be subscripted in order to retrieve one element. Visual Studio 2005 defines CSimpleStringT::operator. At first glance it looks...
1
by: saxenavaibhav17 | last post by:
Hi Friends. I got many help from this forum. Thanks a lot guys. Well friends I have problem.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.