Converting a struct members to a string, c newbie!
I am trying to make a client for use with an sntp server.
The idea is that I send a datagram via the udp socket system to the server containing the current computer time and it responds with the accurate time which I can then compare and update the clock as necessary.
So, I have a struct that creates bitfields in order to build the required packet:
Obviously there are many more fields.
long long timestamp:64;
Now I want to send that using the usual socket send command. However, the send command takes a string as the thing to be sent.
So how do I take each member of the struct, convert it to a string and build up the total string that I need to send, ie put all of the struct memebrs into one long string?
I am new to C and finding it very difficult so any help would be much appreciated!
Thanks in advance