Erlang/OTP Forums

Author Message

<  Erlang  ~  Converting an C array off bytes to an erlang list

noobidoo
Posted: Fri Dec 19, 2008 2:29 pm Reply with quote
Joined: 19 Dec 2008 Posts: 1
I tryed this:

Code:

void array2list(unsigned char* array, ETERM* alist[],int length)
{
 int mack=0;
fprintf(stderr, "array to list::: \n\r");
 while(mack<length){
   alist[mack]=erl_mk_int(array[mack]);
   fprintf(stderr, "%d ,", array[mack]);
  mack++;
  }
}


and then

Code:

resp = erl_format("{cnode, ~w,~w}", erl_mk_list(&e_datalis,d_length));


Just it returns some werd nubers that has nothing to do whit what the value in the array is.
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum