Symbian3/SDK/Source/GUID-2AC1C0B6-0405-5F1D-A813-39DA35808182.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Thu, 21 Jan 2010 18:18:20 +0000
changeset 0 89d6a7a84779
permissions -rw-r--r--
Initial contribution of Documentation_content according to Feature bug 1266 bug 1268 bug 1269 bug 1270 bug 1372 bug 1374 bug 1375 bug 1379 bug 1380 bug 1381 bug 1382 bug 1383 bug 1385

<?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 xml:lang="en" id="GUID-2AC1C0B6-0405-5F1D-A813-39DA35808182"><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><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. 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><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&amp;</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 the active scheduler in Symbian platform, 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><title>See also</title> <p> <xref href="GUID-890F06C6-DE32-5EB1-BF0F-D41794F47AE1.dita">Active Objects</xref> </p> </section> </conbody></concept>