Xavier
Xavier

Reputation: 9069

What is the best way to represent a C array in Erlang?

What is the best way to represent a C array in Erlang? I plan on passing a C array to Erlang using NIF. The array is composed of bytes and I'll need to modify some of the bytes as the program runs. Any help is appreciated.

Upvotes: 3

Views: 499

Answers (2)

keymone
keymone

Reputation: 8104

erlang is pretty good when dealing with binaries(essentially byte arrays right?)

check it out here: http://www.erlang.org/documentation/doc-5.6/doc/programming_examples/bit_syntax.html

Upvotes: 1

Sergey Miryanov
Sergey Miryanov

Reputation: 1830

If function in NIF not reallocate array than you can represent you array as a tuple with two elements - raw pointer and elements count.

Upvotes: 4

Related Questions