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

Mobile

 
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 
GeneralRe: STL string problem Pin
Jonas Larsson19-Jun-03 2:11
Jonas Larsson19-Jun-03 2:11 
Jose M Castellanos wrote:
//Here the string is correct, someting like "Origin: main street"
return s.c_str();
//But the function returns something like "@X#R" (different each time)


You are returning a const TCHAR* to a local variable. After the function exits, that memory is freed, and your pointer is pointing to garbage.


Jose M Castellanos wrote:
const TCHAR* sFoo;
sFoo= new TCHAR[200];
sFoo = s.c_str();
return sFoo;


You are still returning a pointer to a local variable here (+ leaking 200 * sizeof(TCHAR) bytes).

Jose M Castellanos wrote:
Answers will be really welcomed

Potential memory leaks aside, if you want this to work you have to copy the string to the buffer you create:
_tcsncpy(sFoo, s.c_str(), 200);
though changing you interface to something like:
bool CCommandToTextConvert::GetSVOrigin(TCHAR* buff, int& size) const
where you allocate (and deallocate) the memory outside the function is a better solution.
Note: You will still have to copy the string to buff.

HTH
Jonas

“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
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 
GeneralThread synchronization in .NET CF Pin
Grommens12-Jun-03 23:48
Grommens12-Jun-03 23:48 

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.