Click here to Skip to main content
15,892,737 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: binary data to image VC++ Pin
Mukund Pradeep3-Feb-15 18:08
Mukund Pradeep3-Feb-15 18:08 
GeneralRe: binary data to image VC++ Pin
Richard MacCutchan3-Feb-15 22:42
mveRichard MacCutchan3-Feb-15 22:42 
GeneralRe: binary data to image VC++ Pin
Mukund Pradeep9-Feb-15 20:17
Mukund Pradeep9-Feb-15 20:17 
QuestionRe: binary data to image VC++ Pin
Richard MacCutchan9-Feb-15 22:10
mveRichard MacCutchan9-Feb-15 22:10 
AnswerRe: binary data to image VC++ Pin
Mukund Pradeep9-Feb-15 22:36
Mukund Pradeep9-Feb-15 22:36 
GeneralRe: binary data to image VC++ Pin
Richard MacCutchan9-Feb-15 23:20
mveRichard MacCutchan9-Feb-15 23:20 
GeneralRe: binary data to image VC++ Pin
Mukund Pradeep10-Feb-15 17:21
Mukund Pradeep10-Feb-15 17:21 
GeneralRe: binary data to image VC++ Pin
Richard MacCutchan10-Feb-15 21:22
mveRichard MacCutchan10-Feb-15 21:22 
GeneralRe: binary data to image VC++ Pin
Mukund Pradeep10-Feb-15 22:05
Mukund Pradeep10-Feb-15 22:05 
AnswerRe: binary data to image VC++ Pin
Chris Losinger18-Jan-15 8:49
professionalChris Losinger18-Jan-15 8:49 
Questioncan a function return WCHAR Pin
bkelly1316-Jan-15 6:07
bkelly1316-Jan-15 6:07 
AnswerRe: can a function return WCHAR Pin
CPallini16-Jan-15 7:54
mveCPallini16-Jan-15 7:54 
GeneralRe: can a function return WCHAR Pin
bkelly1316-Jan-15 13:54
bkelly1316-Jan-15 13:54 
AnswerRe: can a function return WCHAR Pin
Richard Andrew x6416-Jan-15 14:54
professionalRichard Andrew x6416-Jan-15 14:54 
GeneralRe: can a function return WCHAR Pin
CPallini16-Jan-15 22:32
mveCPallini16-Jan-15 22:32 
Quote:
but I have had problems using CString
What problems?



bkelly13 wrote:
The question more properly is: Can a function return a string of WCHAR?
Yes, you can do that (and Richard Andrew x64 already shown you how) however it is error prone, because the allocation is performed by the called function while memory release is left to the caller (simply put: you should know what you are doing). std::wstring (or CString), on the other hand handles the memory allocation/release mechanism internally.



Quote:
ou mentioned std::wstring rather than WCHAR. During startup this app reads a file of some 80,000 data items to describe telemetry parameters it must process. That file is text based. Each line of the text file is tokenized, put in a vector, then the fields can be easily processed to extract the needed info.

Speed is not real critical but so far things seem to work better with WCHAR. Do you have a preference for std::wstring over WCHAR? If so can you explain the reason or direct me to a good comparison of the two?
If speed is not critical I would definitely use std::wstring (or CString) insted of WCHAR arrays (avoiding the hassle of memory handling with the benefit of a more compact and possibly robust code).
GeneralRe: can a function return WCHAR Pin
bkelly1319-Jan-15 7:48
bkelly1319-Jan-15 7:48 
GeneralRe: can a function return WCHAR Pin
CPallini19-Jan-15 8:02
mveCPallini19-Jan-15 8:02 
GeneralRe: can a function return WCHAR Pin
bkelly1321-Jan-15 16:19
bkelly1321-Jan-15 16:19 
GeneralRe: can a function return WCHAR Pin
CPallini22-Jan-15 5:51
mveCPallini22-Jan-15 5:51 
QuestionYASAQ Yet another silly academic question - how does "code optimization" really works? Pin
Vaclav_16-Jan-15 3:55
Vaclav_16-Jan-15 3:55 
AnswerRe: YASAQ Yet another silly academic question - how does "code optimization" really works? Pin
PIEBALDconsult16-Jan-15 4:02
mvePIEBALDconsult16-Jan-15 4:02 
AnswerRe: YASAQ Yet another silly academic question - how does "code optimization" really works? Pin
Richard MacCutchan16-Jan-15 4:49
mveRichard MacCutchan16-Jan-15 4:49 
GeneralRe: YASAQ Yet another silly academic question - how does "code optimization" really works? Pin
CPallini16-Jan-15 5:31
mveCPallini16-Jan-15 5:31 
GeneralRe: YASAQ Yet another silly academic question - how does "code optimization" really works? Pin
Richard MacCutchan16-Jan-15 5:44
mveRichard MacCutchan16-Jan-15 5:44 
QuestionRe: YASAQ Yet another silly academic question - how does "code optimization" really works? Pin
CPallini16-Jan-15 7:39
mveCPallini16-Jan-15 7:39 

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.