Week 23 contribution of PDK documentation content. See release notes for details. Fixes bugs Bug 2714, Bug 462.
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License
"Eclipse Public License v1.0" which accompanies this distribution,
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
Nokia Corporation - initial contribution.
Contributors:
-->
<!DOCTYPE concept
PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
<concept id="GUID-2AC1C0B6-0405-5F1D-A813-39DA35808182" xml:lang="en"><title>STDLIB
Console and I/O operations</title><prolog><metadata><keywords/></metadata></prolog><conbody>
<p>This section explains the console and the asynchronous input/output operations
of STDLIB. </p>
<section id="GUID-C5A9CB9B-3ABA-4192-944C-9F16C6033A9A"><title>Console versus terminals</title> <p>The STDLIB console (encapsulated
by class <codeph>CTtyDesc</codeph>, defined in <filepath>fdesc.h</filepath>)
is a client of the <codeph>CConsoleBase</codeph> class implemented by <filepath>econs.dll</filepath>.
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. </p> <p>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. </p> </section>
<section id="GUID-2F5F2A9F-2FC4-48A1-ADCF-D45BE2AE85A7"><title>Asynchronous I/O vs blocking I/O</title> <p>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 <codeph>fcntl()</codeph> for
individual file descriptors, but STDLIB does not currently implement this
function. </p> <p>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 <codeph>select()</codeph> function. These functions provide a form of
the <codeph>ioctl()</codeph> function which takes a <codeph>TRequestStatus&</codeph> as
a parameter, together with functions for completing the <codeph>ioctl()</codeph> operation
once the status has been signaled or canceling the pending <codeph>ioctl</codeph>.
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 <filepath>estlib.h</filepath> for the interface
to these functions. For more information on active objects and active
scheduler, see <xref href="GUID-890F06C6-DE32-5EB1-BF0F-D41794F47AE1.dita">active
objects</xref>. </p> <p> <b> NOTE</b>: There are no such blocking problems
with I/O to local files, which is essentially a synchronous operation. </p> </section>
<section id="GUID-AB42F727-8976-4D44-97C6-99319D32A420"><title>See also</title> <p> <xref href="GUID-890F06C6-DE32-5EB1-BF0F-D41794F47AE1.dita">Active
Objects</xref> </p> </section>
</conbody></concept>