char string to long conversion (more problems)
Hello, I have the following question:
I am trying to fit a long variable into char string and then convert it back to long (need this to send that string over the network)
char cs[4];
long lv1=12345;
long lv2;
memcpy(cs, &lv1, 4);
lv2=(long)(tsC);
printf("lv2: %lu ", lv2);
for some reason this doesn't work
Thanks in advance,
Bill
:confused:
Re: char string to long conversion (more problems)
Quote:
Originally posted by rastan
I am trying to fit a long variable into char string and then convert it back to long (need this to send that string over the network)
Is this any good for you:
http://www.ecst.csuchico.edu/~beej/g...t_old/#convert