Click here to Skip to main content
15,917,862 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: CPropertySheet stuff Pin
João Paulo Figueira19-Jun-03 9:31
professionalJoão Paulo Figueira19-Jun-03 9:31 
GeneralRe: CPropertySheet stuff Pin
#realJSOP19-Jun-03 9:53
professional#realJSOP19-Jun-03 9:53 
GeneralRe: CPropertySheet stuff Pin
João Paulo Figueira19-Jun-03 22:31
professionalJoão Paulo Figueira19-Jun-03 22:31 
GeneralRe: CPropertySheet stuff Pin
#realJSOP20-Jun-03 0:30
professional#realJSOP20-Jun-03 0:30 
GeneralRe: CPropertySheet stuff Pin
#realJSOP20-Jun-03 4:51
professional#realJSOP20-Jun-03 4:51 
GeneralRe: CPropertySheet stuff Pin
João Paulo Figueira20-Jun-03 5:23
professionalJoão Paulo Figueira20-Jun-03 5:23 
GeneralRe: CPropertySheet stuff Pin
#realJSOP20-Jun-03 5:35
professional#realJSOP20-Jun-03 5:35 
GeneralSTL string problem Pin
Jose M Castellanos19-Jun-03 0:25
Jose M Castellanos19-Jun-03 0:25 
Hello to everyone again:
I am experiencing a troubling problem with stl strings. I will try to be as much precise as possible.
I have this definition, as my DLL must work under WIN32 and WINCE
<br />
#ifdef _UNICODE<br />
#define __tstring std::wstring<br />
#else<br />
#define __tstring std::string<br />
#endif<br />


One object (CContainer) has to build an string with different information obtained from a structure.
<br />
const TCHAR* CContainer::GetCurrentCommandText()<br />
{<br />
  CCommands::LPCOMMAND pCommand = GetCurrentCommand();<br />
  __tstring sReturn;<br />
  sReturn.clear();<br />
  if (pCommand)<br />
  {<br />
    CCommandToTextConvert* pText;<br />
    pText= new CCommandToTextConvert(pCommand);<br />
    sReturn.append(pText->GetSVOrigin());<br />
    sReturn.append(pText->GetSVDestination());<br />
  }<br />


GetSVOrigin and GetSVDestination have a similar code. I'll show GetSVOrigin:

<br />
const TCHAR* CCommandToTextConvert::GetSVOrigin() const<br />
{<br />
  __tstring s;<br />
  s.clear();<br />
  if (m_pCommand->dLong > 0)<br />
  {<br />
    s.append(_T("Origin: "));<br />
    s.append(m_pCommand->sOrigin);<br />
  }<br />
  //Here the string is correct, someting like "Origin: main street"<br />
  return s.c_str();<br />
  //But the function returns something like "@X#R" (different each time)<br />
}<br />


The problem, as mentioned in the code is that when returning, the string gets spoilt. If I make s.c_str() before returning, the result is right. As a result, when trying to append the strings returned by the functions, as each one is wrong, the result is wrong^2

I also tried to do
<br />
	const TCHAR* sFoo;<br />
	sFoo= new TCHAR[200];<br />
	sFoo = s.c_str();<br />
	return sFoo;<br />

But the problem remains the same

What on earth can be the problem? Answers will be really welcomed.


José M Castellanos. Troubled rookie programmer WTF | :WTF:
GeneralRe: STL string problem Pin
Jonas Larsson19-Jun-03 2:11
Jonas Larsson19-Jun-03 2:11 
GeneralRe: STL string problem Pin
Jose M Castellanos19-Jun-03 3:12
Jose M Castellanos19-Jun-03 3:12 
GeneralDatatype misalignment Pin
Cedric Moonen18-Jun-03 23:43
Cedric Moonen18-Jun-03 23:43 
GeneralRe: Datatype misalignment Pin
Jonas Larsson19-Jun-03 2:51
Jonas Larsson19-Jun-03 2:51 
GeneralRe: Datatype misalignment Pin
Cedric Moonen19-Jun-03 3:04
Cedric Moonen19-Jun-03 3:04 
Generalfile opening problem Pin
Cedric Moonen18-Jun-03 4:12
Cedric Moonen18-Jun-03 4:12 
GeneralRe: file opening problem Pin
João Paulo Figueira18-Jun-03 7:04
professionalJoão Paulo Figueira18-Jun-03 7:04 
GeneralRe: file opening problem Pin
Cedric Moonen18-Jun-03 20:53
Cedric Moonen18-Jun-03 20:53 
GeneralRe: file opening problem Pin
João Paulo Figueira19-Jun-03 3:22
professionalJoão Paulo Figueira19-Jun-03 3:22 
GeneralRe: file opening problem Pin
Cedric Moonen19-Jun-03 3:55
Cedric Moonen19-Jun-03 3:55 
GeneralRe: file opening problem Pin
Jonas Larsson19-Jun-03 2:57
Jonas Larsson19-Jun-03 2:57 
GeneralRe: file opening problem Pin
Cedric Moonen19-Jun-03 3:10
Cedric Moonen19-Jun-03 3:10 
GeneralProblem to download and upload binary's from FTP server using eVC++ Pin
AKSIVAKUMAR18-Jun-03 2:01
AKSIVAKUMAR18-Jun-03 2:01 
QuestionRemote Desktop?? Pin
colonyworker17-Jun-03 10:46
colonyworker17-Jun-03 10:46 
GeneralLB_INITSTORAGE Pin
IceBerG7115-Jun-03 23:23
IceBerG7115-Jun-03 23:23 
Questionhow to set bypass listt for the proxy for IE 5.5 on Windows CE .NET Pin
subramjobmail15-Jun-03 18:30
subramjobmail15-Jun-03 18:30 
GeneralResizing Images in Palm OS Pin
minus14-Jun-03 8:17
minus14-Jun-03 8:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.