This section explains the console and the asynchronous input/output operations of STDLIB.
The STDLIB console (encapsulated
by class CTtyDesc
, defined in fdesc.h
)
is a client of the CConsoleBase
class implemented by econs.dll
.
It provides very simple text input and output with no support for embedded
control sequences. When STDLIB receives a character from the console it prints
it out to the same console, providing a "local echo" facility to make simple
command-line interfaces possible.
STDLIB does not provide any sort of terminal driver or line-discipline. In particular there is no support for local processing of backspace, nor any line buffering. Neither does it provide termio or termcap facilities. The Symbian platform is a graphics-based system and it is recommended that C code be ported into a Symbian program which uses a graphical user interface.
All STDLIB I/O
operations are blocking; that is they will suspend the calling thread indefinitely
until the I/O completes. Hence, in general, STDLIB I/O must not be used in
a Symbian platform active object because it will cause the entire active scheduler
to block. A possible way to avoid this problem might be to use fcntl()
for
individual file descriptors, but STDLIB does not currently implement this
function.
Asynchronous I/O can be achieved using a set of C++ functions
provided by STDLIB which implement a per-file-descriptor equivalent of the
POSIX select()
function. These functions provide a form of
the ioctl()
function which takes a TRequestStatus&
as
a parameter, together with functions for completing the ioctl()
operation
once the status has been signaled or canceling the pending ioctl
.
This scheme can be used within an active object to wait for a socket to become
ready for reading or writing, so that the subsequent i/o does not block the
whole active scheduler. See estlib.h
for the interface
to these functions. For more information on active objects and active
scheduler, see active
objects.
NOTE: There are no such blocking problems with I/O to local files, which is essentially a synchronous operation.