Click here to Skip to main content
       

C / C++ / MFC

 
QuestionRe: Read binary File PinmemberDavidCrow29-Nov-12 2:37 
Questionextracting resources from an exe for translation Pinmemberchronodekar28-Nov-12 21:28 
AnswerRe: extracting resources from an exe for translation PinmemberMattias G3-Dec-12 22:24 
Questioncompile code twice,why the two result is differrent Pinmemberyingkou28-Nov-12 21:10 
AnswerRe: compile code twice,why the two result is differrent PinmemberStefan_Lang28-Nov-12 22:31 
AnswerRe: compile code twice,why the two result is differrent PinmemberStephen Hewitt29-Nov-12 0:42 
AnswerRe: compile code twice,why the two result is differrent Pinmembersajeesh.c30-Nov-12 18:28 
AnswerRe: compile code twice,why the two result is differrent PinmemberCristian Amarie3-Dec-12 8:55 
QuestionCListCtrl Pinmembersarfaraznawaz28-Nov-12 21:07 
AnswerRe: CListCtrl PinmemberJochen Arndt28-Nov-12 21:30 
QuestionLong pointer to character C++ Pinmemberpix_programmer28-Nov-12 4:41 
GeneralRe: Long pointer to character C++ PinmemberDavidCrow28-Nov-12 5:19 
AnswerRe: Long pointer to character C++ PinmvpRichard MacCutchan28-Nov-12 5:20 
AnswerRe: Long pointer to character C++ PinmemberStefan_Lang28-Nov-12 6:07 
pix_programmer wrote:
I'm reading some string from a XML file and assigning it to a <code>const char*</code> variable.

That doesn't make sense. A pointer can only be sensibly initialized within the program, at runtime, because only then does the computer know where in memeory every object lies. Therefore it doesn't make sense to either store or restore a pointer to/from a file!
 
What you need to do instead is:
1. read that string from your file
2. Allocate a char array on the heap that is big enough to contain that string (including the terminating NULL character!)
3. Assign that array to your pointer
4. Store the string in that char array.
 
Of course, if you use std::string, that would save you some of that efort.
GeneralRe: Long pointer to character C++ PinmemberDavidCrow28-Nov-12 7:56 
GeneralRe: Long pointer to character C++ PinmemberStefan_Lang28-Nov-12 22:03 
AnswerRe: Long pointer to character C++ PinmvpCPallini28-Nov-12 7:48 
AnswerRe: Long pointer to character C++ Pinmembersajeesh.c30-Nov-12 18:35 
AnswerRe: Long pointer to character C++ [modified] PinmemberApril Fans13-Dec-12 18:06 
Questionproblem in c with linux Pinmembera1_shay28-Nov-12 2:23 
AnswerRe: problem in c with linux PinmvpCPallini28-Nov-12 3:07 
SuggestionRe: problem in c with linux PinmvpRichard MacCutchan28-Nov-12 3:11 
GeneralRe: problem in c with linux Pinmembera1_shay28-Nov-12 21:35 
GeneralRe: problem in c with linux PinmvpRichard MacCutchan28-Nov-12 23:04 
AnswerRe: problem in c with linux Pinmembersajeesh.c30-Nov-12 18:40 
QuestionMerging Arrays Pinmemberpix_programmer27-Nov-12 21:57 
AnswerRe: Merging Arrays PinmemberAndy41127-Nov-12 22:48 
AnswerRe: Merging Arrays PinmvpCPallini27-Nov-12 23:09 
JokeRe: Merging Arrays PinmvpRichard MacCutchan27-Nov-12 23:45 
JokeRe: Merging Arrays PinmvpCPallini27-Nov-12 23:58 
GeneralRe: Merging Arrays PinmemberDavidCrow28-Nov-12 5:36 
AnswerRe: Merging Arrays PinmemberStefan_Lang28-Nov-12 2:45 
AnswerRe: Merging Arrays Pinmembersajeesh.c30-Nov-12 18:47 
QuestionHow to use ribbon in MFC Activex control PinmemberLamourou27-Nov-12 20:23 
AnswerRe: How to use ribbon in MFC Activex control PinmvpRichard MacCutchan27-Nov-12 23:44 
GeneralMessage Removed PinmemberLamourou28-Nov-12 0:26 
GeneralRe: How to use ribbon in MFC Activex control PinmvpRichard MacCutchan28-Nov-12 1:10 
Questionhow to use more than one rc file in vc6 project at the same time when compiling project [modified] Pinmemberyingkou27-Nov-12 19:59 
AnswerRe: how to use more than one rc file in vc6 project at the same time when compiling project PinmvpRichard MacCutchan27-Nov-12 23:42 
GeneralRe: how to use more than one rc file in vc6 project at the same time when compiling project Pinmemberyingkou28-Nov-12 14:35 
AnswerRe: how to use more than one rc file in vc6 project at the same time when compiling project PinmemberDavidCrow28-Nov-12 17:33 
AnswerRe: how to use more than one rc file in vc6 project at the same time when compiling project PinmemberFreak3028-Nov-12 23:33 
Questiontransparency in 32bit bmp in vs2010 Pinmemberyogeshs27-Nov-12 19:21 
AnswerRe: transparency in 32bit bmp in vs2010 PinmemberHadi Dayvary27-Nov-12 21:42 
GeneralRe: transparency in 32bit bmp in vs2010 Pinmemberyogeshs27-Nov-12 23:11 
GeneralRe: transparency in 32bit bmp in vs2010 PinmemberHadi Dayvary28-Nov-12 0:00 
QuestionHow To Use Macro In dsp file(VC6.0 *.dsp file) Pinmemberyingkou27-Nov-12 14:59 
SuggestionRe: How To Use Macro In dsp file(VC6.0 *.dsp file) PinmemberAlbert Holguin27-Nov-12 16:30 
GeneralRe: How To Use Macro In dsp file(VC6.0 *.dsp file) Pinmemberyingkou28-Nov-12 21:50 
GeneralRe: How To Use Macro In dsp file(VC6.0 *.dsp file) PinmemberAlbert Holguin29-Nov-12 4:55 

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

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


Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 13 Jul 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid