[erlang-questions] how: binary from pipe in os:cmd
Miguel Rodríguez Rubinos
Mon Jan 14 20:41:14 CET 2008
I'd like to read a binary from 'os:cmd("some_command with_args -")'.
This generates a binary that is sent through stdout as result.
The problem is that 'os:cmd' seems to stop reading when bytes 0x00
(NULL) or 0x04 (EOT) are found. So, usually, it doesn't return the
Has anybody idea of how to do this? I would like to read the entire
binary, not only the first N characters until 0x00 or 0x04.
For example, if you type
33> length(os:cmd("lame --silent bark.wav -")).
Tha character at position 135 of resulting mp3 is 0x04. Besides,
full mp3 size should be 576 bytes.
Thanks in advance.
Miguel Rodríguez Rubinos <>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2411 bytes
Desc: not available
More information about the erlang-questions