<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Convert C types to Erlang types</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">I'm make a server socket in Erlang and I send message from C client. The C client send the next message:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">typedef struct</FONT>
<BR><FONT SIZE=2 FACE="Arial">{</FONT>
<BR> <FONT SIZE=2 FACE="Arial">int first;</FONT>
<BR> <FONT SIZE=2 FACE="Arial">char second;</FONT>
<BR><FONT SIZE=2 FACE="Arial">} Message;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">char buf[1024];</FONT>
<BR><FONT SIZE=2 FACE="Arial">Message*p;</FONT>
<BR><FONT SIZE=2 FACE="Arial">p = (Message*) buf;</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">p->first = 1567;</FONT>
<BR><FONT SIZE=2 FACE="Arial">p->second = 's';</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">send(s, buf, sizeof(Message), 0);</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">In the Erlang server I'm receive the next binary message:</FONT>
<BR><FONT SIZE=2 FACE="Arial"><<31,6,0,0,115,255,255,255>></FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I need convernt this structure to the corresponding C structure. Exist in Erlang something function to make this conversion?</FONT></P>
<BR>
</BODY>
</HTML>