C++ to C


 
Thread Tools Search this Thread
Top Forums Programming C++ to C
# 22  
Old 02-22-2010
As usual, I can't see your code from here so can't tell why it's segmentation faulting. if I had to guess, I'd guess you were feeding integers into crc_add instead of pointers to integers.

Code:
// For integers, objects, etc 
crc_add(&crc, &object, sizeof(object));
// for arrays
crc_add(&crc, array, sizeof(array));
// for a pointer
crc_add(&crc, pointer, sizeof(*pointer));
// for a string
crc_add(&crc, string, strlen(string));

This is all from basic understanding of pointers in the C language.
# 23  
Old 02-22-2010
so from my previous structure, can I pass (message.header.cksum)? which form?
# 24  
Old 02-22-2010
Is it an integer, object, structure, or other such memory blob? Use the syntax I gave for that.

Is it an array? Use the syntax I gave for that.

Is it a pointer? Use the syntax I gave for that.

Is it a string? Use the syntax I gave for that.
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question