bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: major problem with trivial piece of code


From: Heusden van, FJJ (Folkert)
Subject: RE: major problem with trivial piece of code
Date: Fri, 30 Jan 2004 13:06:20 +0100

You forgot to add your own text :-)

Anyway, I might have found it: it seems to be a problem with the \n in the text.
It seems that if you wprintw() a string with a \n in it, only spaces are 
printed.

-----Oorspronkelijk bericht-----
Van: Thomas Dickey [mailto:address@hidden
Verzonden: vrijdag 30 januari 2004 12:54
Aan: Heusden van, FJJ (Folkert)
CC: address@hidden; address@hidden
Onderwerp: Re: major problem with trivial piece of code


On Fri, 30 Jan 2004, Heusden van, FJJ (Folkert) wrote:

> Hi,
>
> I have big problems with a trivial piece of code.
> A fragment of the code follows. fd is a socket.
>
> #include <curses.h>
> ...
>       char buffer[4096 + 1];
>       int rc = read(fd, buffer, 4096);
>
>       if (rc > 0)
>       {
>               buffer[rc] = 0x00;
>
>               wprintw(stdscr, "%s", buffer);
                refresh();
>
>               write(3, buffer, rc);
>       }
>
> One would now expect that everything that gets in through that socket would 
> be displayed on the
> terminalscreen. That is not the case! The only thing that happens is that the 
> cursor moves when
> an LF comes in.
> When I run my program with "./a.out 3> log", the output IS written to that 
> logfile 'log'! So
> data does come in.
> Somewhere else in the code I have "wprintw(stdscr, "%c", buffer[0])": that 
> one works as expected!
>
> Anyone any idea what might go wrong?
> (the total code is available at: 
> http://www.vanheusden.com/Linux/recvnet-0.0.1.tgz )
>
>
> Folkert
>
>
> ================================================
> De informatie opgenomen in dit bericht kan vertrouwelijk zijn en
> is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht
> onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en
> de afzender direct te informeren door het bericht te retourneren.
> ================================================
> The information contained in this message may be confidential
> and is intended to be exclusively for the addressee. Should you
> receive this message unintentionally, please do not use the contents
> herein and notify the sender immediately by return e-mail.
>
>

-- 
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




================================================
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en 
is uitsluitend bestemd voor de geadresseerde. Indien u dit bericht 
onterecht ontvangt, wordt u verzocht de inhoud niet te gebruiken en 
de afzender direct te informeren door het bericht te retourneren. 
================================================
The information contained in this message may be confidential 
and is intended to be exclusively for the addressee. Should you 
receive this message unintentionally, please do not use the contents 
herein and notify the sender immediately by return e-mail.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]