WvStreams
wvstreamex4.cc
1 /*
2  * A WvStream example.
3  *
4  * Some text about this example...
5  */
6 
7 #include <wvstream.h>
8 
9 int main()
10 {
11  char buffer[10];
12  size_t numread;
13 
14  while (wvcon->isok())
15  {
16  if (wvcon->select(-1))
17  {
18  numread = wvcon->read(buffer, sizeof(buffer));
19  if (numread)
20  {
21  wvcon->print("You said: ");
22  wvcon->write(buffer, numread);
23  wvcon->print(" (%s bytes)\n", numread);
24  }
25  }
26  }
27 }
WvStream::write
virtual size_t write(const void *buf, size_t count)
Write data to the stream.
Definition: wvstream.cc:532
WvStream::select
bool select(time_t msec_timeout)
Return true if any of the requested features are true on the stream.
Definition: wvstream.h:376
WvStream::read
virtual size_t read(void *buf, size_t count)
read a data block on the stream.
Definition: wvstream.cc:490
WvStream::isok
virtual bool isok() const
return true if the stream is actually usable right now
Definition: wvstream.cc:445