Hi,
Since I need to send a long variable through a network. I need to convert it to a char * first. I tried to use reinterpret_cast without success.
Code:
long numBytes = 0;
char *test;
char sendData = 0x00;

numBytes = ftell( stream );
test = reinterpret_cast<char *>(&numBytes);
sendData = test[0];
I am using visual studio and this is what the debugger shows me:
numBytes 0x000058d7 long
&numBytes 0x0107fcb4 long *
test[0] 0xd7 '×' char
test[1] 0x58 'X' char
test 0x0107fcb4 "×X" char *

It seems test has the correct pointer but then I want to retrieve 58 and d7 from the original long variable but instead test[0] and test[1] gives me Xs. Can someone explain what I am doing wrong. Thanks a lot
Amish