[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
major problem with trivial piece of code
From: |
Heusden van, FJJ (Folkert) |
Subject: |
major problem with trivial piece of code |
Date: |
Fri, 30 Jan 2004 10:56:16 +0100 |
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);
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.