I would appreciate any suggestions. I have a client and server program. The server writes a struct to a socket:
the server writes a struct to the socket as a long array of chars 1034 bytes long...
unsigned long int checksum;
now the client reads the packet into a char buffer i've allocated.
now i want to parse all the respective fields from the buffer. i am thinking of using:
will/should this work in the way i have it written? i tried it this was and read FFFFFFFF for size, and for the data as well. don't quite know why.
struct packet current;
sscanf(buffer, " %i %i %i %1024c %uli", ¤t.seq, ¤t.type, ¤t.size, current.data, ¤t.checksum);
i know that i could do a series of memcpy's to copy the fields, but is there any easier way to do this?
thanks in advance!!