help "wrapping" data types in char array
Hi, I've been working on a problem of mine, and I'm currently tearing my hair out...... basically what I'm trying to do is implement a simple client / server protocol in C. My problem lies in the fact that I have a char* (char array) which I use for my buffer to pass to a C function to send it across the socket to the server/client. What I want to do is to fill this char array with structs OR other data types such as floats. Now I thought this would be possible by filling every 4th char in the array with a float (a float is 4 bytes), and then casting it at the other end, but apparently this isn't working. Can anyone help me before I start stomping on my computer?
Many Thanks
Tom