P
petertwocakes
Hi,
I'm trying to test a sequence of 4 characters from a ptr buffer
against a long, but the test fails even though I think they should
have the same value. e.g :
char word[4] = {'w', 'o', 'r', 'd'};
char *wordPtr = (char*)wordArray;
long wordLong = 'word';
long *longPtr = (long*)wordArrayPtr;
long longPtrVal = *longPtr;
Yet, in the end wordLong = 2003792484, but longPtrVal = 1685221239
Shouldn't they be same?
If not, how do test 4 character sequences in chunks like this?
(without laboriously testing each char individually)
I'm in a very large text buffer incrementing the current ptr until I
hit "word"
Thanks
I'm trying to test a sequence of 4 characters from a ptr buffer
against a long, but the test fails even though I think they should
have the same value. e.g :
char word[4] = {'w', 'o', 'r', 'd'};
char *wordPtr = (char*)wordArray;
long wordLong = 'word';
long *longPtr = (long*)wordArrayPtr;
long longPtrVal = *longPtr;
Yet, in the end wordLong = 2003792484, but longPtrVal = 1685221239
Shouldn't they be same?
If not, how do test 4 character sequences in chunks like this?
(without laboriously testing each char individually)
I'm in a very large text buffer incrementing the current ptr until I
hit "word"
Thanks