strange behavior on port send

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

strange behavior on port send

Garry Hodgson-3

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.

sorry.

--
Garry Hodgson                   sometimes we ride on your horses
Senior Hacker                   sometimes we walk alone
Software Innovation Services    sometimes the songs that we hear
AT&T Labs                       are just songs of our own
garry


Reply | Threaded
Open this post in threaded view
|

strange behavior on port send

Claes Wikström
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       --