Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 1524

mozart-1.4.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>4 Input and Output of Text</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node5.html#chapter.files">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node10.html#chapter.sockets">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="chapter.text"><H1><A name="chapter.text">4 Input and Output of Text</A></H1><P>The example in <A href="node7.html#section.files.expand-a">Section&nbsp;3.2</A> resulted in a very inefficient program: reading the entire file to a list and processing it afterwards is extremely memory consuming.</P><P>A far better solution is to process the file incrementally line by line. This pattern of reading files occurs in fact very often, thus we provide support for it. The support provided is a mixin class <CODE>Open<SPAN class="keyword">.</SPAN>text</CODE>. This mixin class can be used together with files, sockets, and pipes. </P><HR><UL class="toc"><LI><A href="node9.html#section.text.expand">4.1 Expanding TAB Characters Revisited</A></LI></UL></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node5.html#chapter.files">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node10.html#chapter.sockets">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>