Click here to Skip to main content
15,889,808 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Why my 64 architecture exe is not able to read registry? Pin
MicroVirus30-May-11 3:46
MicroVirus30-May-11 3:46 
AnswerRe: Why my 64 architecture exe is not able to read registry? Pin
Rolf Kristensen30-May-11 6:17
Rolf Kristensen30-May-11 6:17 
QuestionProblem with Imagelist_LoadBitmap Pin
Cold_Fearing_Bird29-May-11 7:26
Cold_Fearing_Bird29-May-11 7:26 
AnswerRe: Problem with Imagelist_LoadBitmap Pin
Niklas L29-May-11 8:39
Niklas L29-May-11 8:39 
QuestionPassing char* to a function and change the argument problem Pin
.jpg29-May-11 6:24
.jpg29-May-11 6:24 
AnswerRe: Passing char* to a function and change the argument problem Pin
CPallini29-May-11 6:38
mveCPallini29-May-11 6:38 
AnswerRe: Passing char* to a function and change the argument problem Pin
Richard MacCutchan29-May-11 13:26
mveRichard MacCutchan29-May-11 13:26 
GeneralRe: Passing char* to a function and change the argument problem Pin
MicroVirus30-May-11 3:37
MicroVirus30-May-11 3:37 
Actually this is bad practice.

This code is good:
char str[] = "Hello World";


This code is bad:
char* str = "Hello World";

The difference? In the first example str is allocated on the stack and you have full read and write access to it.
On the second, str points to a memory location containing the string "Hello World", but this memory could be allocated in a static (read only) section. Or consider a piece of code where you have this string literal multiple times. A compiler might decide to store it once and make all references to the string point to the same location. Then when you change it in one location it changes in all, but that wasn't your intention!
Instead, you should consider using a const char*, or if you want to modify it use string functions.
const char* str = "Hello World";
// Or:
char str[200] = "Hello World";
//now you can place strings up to length 199 (+null-termination) in str using memcpy's or string functions

GeneralRe: Passing char* to a function and change the argument problem Pin
Richard MacCutchan30-May-11 4:13
mveRichard MacCutchan30-May-11 4:13 
GeneralRe: Passing char* to a function and change the argument problem Pin
MicroVirus30-May-11 4:39
MicroVirus30-May-11 4:39 
AnswerRe: Passing char* to a function and change the argument problem Pin
«_Superman_»29-May-11 19:30
professional«_Superman_»29-May-11 19:30 
GeneralRe: Passing char* to a function and change the argument problem Pin
Richard MacCutchan29-May-11 22:49
mveRichard MacCutchan29-May-11 22:49 
Questionproblem releasing .exe to vs2008 users Pin
UdiOshi28-May-11 4:49
UdiOshi28-May-11 4:49 
AnswerRe: problem releasing .exe to vs2008 users Pin
barneyman28-May-11 5:17
barneyman28-May-11 5:17 
GeneralRe: problem releasing .exe to vs2008 users Pin
UdiOshi28-May-11 5:20
UdiOshi28-May-11 5:20 
AnswerRe: problem releasing .exe to vs2008 users Pin
«_Superman_»28-May-11 17:31
professional«_Superman_»28-May-11 17:31 
QuestionDoes VS resource compiler support PNG file Pin
Cold_Fearing_Bird28-May-11 2:36
Cold_Fearing_Bird28-May-11 2:36 
AnswerRe: Does VS resource compiler support PNG file Pin
Alain Rist28-May-11 3:36
Alain Rist28-May-11 3:36 
QuestionPointers to member functions which return pointers to themselves Pin
Ray Hagstrom27-May-11 11:08
Ray Hagstrom27-May-11 11:08 
QuestionRe: Pointers to member functions which return pointers to themselves Pin
CPallini28-May-11 3:01
mveCPallini28-May-11 3:01 
AnswerRe: Pointers to member functions which return pointers to themselves Pin
Ray Hagstrom31-May-11 12:40
Ray Hagstrom31-May-11 12:40 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
CPallini31-May-11 21:08
mveCPallini31-May-11 21:08 
AnswerRe: Pointers to member functions which return pointers to themselves Pin
Stefan_Lang30-May-11 4:50
Stefan_Lang30-May-11 4:50 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
Ray Hagstrom31-May-11 12:46
Ray Hagstrom31-May-11 12:46 
GeneralRe: Pointers to member functions which return pointers to themselves Pin
Stefan_Lang31-May-11 21:15
Stefan_Lang31-May-11 21:15 

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.