TRACE (" the test string is: % s \ n ", testarray); -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - & gt; The correct execution
TRACE (" the test string2 is: % s \ n ", (char *) (testarray) (int)); -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- & gt; Perform error
Is the system differences caused by?
CodePudding user response:
Int is 32 bits in the VS, if it is a 64 - bit system will naturally be truncatedTry __int64
CodePudding user response:
Look at the before and after conversion, if there is a change addressCodePudding user response:
Indeed as expected is truncated, thank zgl7903 oyljerry, char * type of Windows 7 is 4 bytes, doing and win10 are 8 bytes, system is 64 - bit, it's a pit, or don't use pointer to int storage of good, is the size of the pointer is determined by what people can say clear?CodePudding user response:
Pointer specified size and compiler environment, WIN32 32-bit X64 64For compatible compiler environment can use INT_PTR
TRACE (_T (" the test string2 is: % s \ n "), (char *) (INT_PTR testarray)); -