Click here to Skip to main content
15,564,736 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Converting an image into jpeg format Pin
CPallini12-Apr-10 22:21
mveCPallini12-Apr-10 22:21 
QuestionWindows date change event Pin
Vijjuuu.12-Apr-10 21:40
Vijjuuu.12-Apr-10 21:40 
AnswerRe: Windows date change event Pin
David Crow13-Apr-10 3:56
David Crow13-Apr-10 3:56 
AnswerRe: Windows date change event Pin
KarstenK13-Apr-10 5:34
mveKarstenK13-Apr-10 5:34 
QuestionC - Application reusing memory locations that have been altered Pin
Member 259847812-Apr-10 14:35
Member 259847812-Apr-10 14:35 
AnswerRe: C - Application reusing memory locations that have been altered Pin
Garth J Lancaster12-Apr-10 16:09
professionalGarth J Lancaster12-Apr-10 16:09 
GeneralRe: C - Application reusing memory locations that have been altered Pin
Member 259847812-Apr-10 18:06
Member 259847812-Apr-10 18:06 
GeneralRe: C - Application reusing memory locations that have been altered Pin
Tim Craig12-Apr-10 18:42
Tim Craig12-Apr-10 18:42 
Ok, I think the problem you're having is how the compiler handles string literals by default. Every sting constant such as your "Hello!" has to be stored in your .exe file. By default, I think, VC++ combines indentical string literals into one instance to save space. Most of the time, these are put into programs to be treated as constants. In your case, you're saying it's ok to modify the memory locations that hold "Hello!". Since the compiler combines all instances of "Hello!" into one, all pointers to it will point to the same block of memory. Change that memory and it's changed for all instances.

I think there's a compiler or linker flag to force code generation to not combine string literals but I couldn't find it when I looked. Maybe they did away with it since the last version I saw that had it and now you're stuck with what you're seeing.

One way around it would be to define "Hello!" once and copy it to a separate buffer each time you want to play with it.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.

GeneralRe: C - Application reusing memory locations that have been altered Pin
enhzflep13-Apr-10 3:03
enhzflep13-Apr-10 3:03 
AnswerRe: C - Application reusing memory locations that have been altered Pin
Eugen Podsypalnikov12-Apr-10 21:34
Eugen Podsypalnikov12-Apr-10 21:34 
QuestionDLL in memory Pin
RomTibi12-Apr-10 9:53
RomTibi12-Apr-10 9:53 
QuestionRe: DLL in memory Pin
David Crow12-Apr-10 11:11
David Crow12-Apr-10 11:11 
AnswerRe: DLL in memory Pin
RomTibi13-Apr-10 7:35
RomTibi13-Apr-10 7:35 
AnswerRe: DLL in memory Pin
David Crow13-Apr-10 7:40
David Crow13-Apr-10 7:40 
GeneralRe: DLL in memory Pin
RomTibi13-Apr-10 7:55
RomTibi13-Apr-10 7:55 
GeneralRe: DLL in memory Pin
David Crow13-Apr-10 7:57
David Crow13-Apr-10 7:57 
GeneralRe: DLL in memory Pin
RomTibi13-Apr-10 7:59
RomTibi13-Apr-10 7:59 
AnswerRe: DLL in memory Pin
«_Superman_»12-Apr-10 11:30
professional«_Superman_»12-Apr-10 11:30 
GeneralRe: DLL in memory Pin
RomTibi13-Apr-10 7:37
RomTibi13-Apr-10 7:37 
AnswerRe: DLL in memory Pin
@Intersect☺™12-Apr-10 20:39
professional@Intersect☺™12-Apr-10 20:39 
GeneralRe: DLL in memory Pin
RomTibi13-Apr-10 7:38
RomTibi13-Apr-10 7:38 
AnswerRe: DLL in memory Pin
Stephen Hewitt13-Apr-10 15:05
Stephen Hewitt13-Apr-10 15:05 
QuestionVisual Studio 6.0 (1998) VS Visual Studio .NET 2003 (Working on MFC) [modified] Pin
Mr. Tomay12-Apr-10 8:11
Mr. Tomay12-Apr-10 8:11 
AnswerRe: Visual Studio 6.0 (1998) VS Visual Studio .NET 2003 (using MFC) Pin
«_Superman_»12-Apr-10 8:39
professional«_Superman_»12-Apr-10 8:39 
AnswerRe: Visual Studio 6.0 (1998) VS Visual Studio .NET 2003 (using MFC) Pin
Maximilien12-Apr-10 8:49
Maximilien12-Apr-10 8:49 

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.