Robot Eksperimentarium 2006: Øvelser

From ImageWiki

(Difference between revisions)
Jump to: navigation, search
(→Øvelse 5: Kommunikation)
(→Udleveret kode)
Line 225: Line 225:
== Udleveret kode ==
== Udleveret kode ==
 +
 +
 +
inline void send_float(TCPSocket *socket, float f)
 +
{
 +
    socket->send((char*)(&(f)), sizeof(float));
 +
}
 +
inline float get_float(TCPSocket *socket)
 +
{
 +
    char buffer[sizeof(float)];
 +
    socket->recv(buffer, sizeof(float));
 +
    return *((float*)buffer);
 +
}
== Praktiske kommentarer ==
== Praktiske kommentarer ==

Revision as of 09:15, 25 September 2006

Personal tools