If you want to change the passed pointer value then you have to pass its address (because, like any other kind of parameter, pointers are passed by value) ending up with a double pointer or a reference to the pointer. e.g.
You are allocating assigning the address of the string literal "test" to the pointer s thus overwriting the address returned by malloc. You should be using strcpy to copy the four characters into the allocated buffer.
better terminology as pointed out by member below.
What all the others said and more generally rarely if ever do use an equal sign on a string in C at any other time than creation.
There are functions required to add, copy, compare, split and search strings and you can't just use mathematical symbols like "=" and "+" to do things with strings like you can in some higher languages. Strings are not mathematical types and you can't use mathematical functions to do things with them.
Those coming from a coding background in Java or Basic tend to do what you did and you have to unlearn it when using C because "string1" + "string2" will not work either, you will need to use strcat functions. String compares are likewise a function and you can't use mathematical equality signs to compare two strings.
Learning the string functions, it is a requirement of learning the C language.
It should be supported in XP - the folder was called "Application Data" / "Local Data" back then.
They changed it to "AppData\Roaming" and "AppData\Local" in Vista to reduce the chances of code breaking the 260-character path limit. Similarly, the "Documents and Settings" folder was renamed to "Users".
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
This break in CWnd::WindowProc randomly appears when running my application(originally released in 2010 and runs 24/7 in many places) in debug. In release mode it crashes.
The message type is always 874(x36A).
The only true call backs I have are for custom draw list boxes and typically when I have an error in those routines MFC catches and breaks at that point. Obviously that are countless other messages processed.
I am trying to determine A: what is message 874? and B: what circumstances cause it to be posted (though A may answer B)?