strange behavior on port send
Klacke
klacke@REDACTED
Mon May 21 10:56:13 CEST 2001
On Fri, May 18, 2001 at 02:43:52PM -0400, Garry Hodgson wrote:
>
> Garry Hodgson (that's me) wrote:
>
> > i'm trying to interface to an external application, and having
> > some problems. i'm using code derived from the "Section 4. Ports"
> > example in the interoperability tutorial.
>
> errrrr....uhhhhhh....never mind.
>
> <stops to wipe egg off face>
>
> i'd done something stupid, adding a debug statement at the end
> of the encode() routine, so the wrong value was ascribed to the
> function.
> that'll teach me to read the error message more carefully.
>
eggs and all ... there's another minor problem that typically needs
to be taken care of when using open_port(... , [{packet, 0} ...
and that is buffering printf()'s from the c program at the
other end of the Erlang port.
Here's a code snippet:
char b1[BUFSIZ], b2[BUFSIZ], b3[BUFSIZ];
setvbuf(stdin, b1, _IOLBF, BUFSIZ);
setvbuf(stdout, b2, _IOLBF, BUFSIZ);
setvbuf(stderr, b3, _IOLBF, BUFSIZ);
/klacke
--
Claes Wikstrom -- Caps lock is nowhere and
Alteon WebSystems -- everything is under control
http://www.bluetail.com/~klacke --
More information about the erlang-questions
mailing list