Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > by-pkgid > 2fc07611b08d4a735fd34d5eb60d8e16 > files > 2257

ciao-1.10p8-3mdv2010.0.i586.rpm

<HTML>
<HEAD>
<!-- Created by texi2html 1.56k + clip patches and <A href="http://www.clip.dia.fi.upm.es/Software">lpdoc</A> from ciao.texi on 28 January 2007 -->

<LINK rel="stylesheet" href="ciao.css" type="text/css">
<TITLE>The Ciao Prolog System               - File I/O utilities</TITLE>
</HEAD>
<BODY> 
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_77.html">previous</A>, <A HREF="ciao_79.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
<P><HR><P>


<H1><A NAME="SEC335" HREF="ciao_toc.html#TOC335">File I/O utilities</A></H1>
<P>
<A NAME="IDX4553"></A>


<P>
<STRONG>Author(s):</STRONG> The CLIP Group.


<P>
<STRONG>Version:</STRONG> 1.10#7 (2006/4/26, 19:22:13 CEST)


<P>
<STRONG>Version of last change:</STRONG> 1.9#216 (2003/12/21, 2:30:59 CET)


<P>
This module implements the file I/O utilities.



<UL>
<LI><A HREF="ciao_78.html#SEC336">Usage and interface (file_utils)</A>
<LI><A HREF="ciao_78.html#SEC337">Documentation on exports (file_utils)</A>
</UL>



<H2><A NAME="SEC336" HREF="ciao_toc.html#TOC336">Usage and interface (<CODE>file_utils</CODE>)</A></H2>

<div class="cartouche">

<UL>

<LI><STRONG>Library usage:</STRONG>

<CODE>:- use_module(library(file_utils)).</CODE>

<LI><STRONG>Exports:</STRONG>


<UL>

<LI><EM>Predicates:</EM>

<A NAME="IDX4554"></A>
<CODE>file_terms/2</CODE>, 
<A NAME="IDX4555"></A>
<CODE>copy_stdout/1</CODE>, 
<A NAME="IDX4556"></A>
<CODE>file_to_string/2</CODE>, 
<A NAME="IDX4557"></A>
<CODE>stream_to_string/2</CODE>.

</UL>

<LI><STRONG>Other modules used:</STRONG>


<UL>

<LI><EM>System library modules:</EM>

<A NAME="IDX4558"></A>
<CODE>read</CODE>, 
<A NAME="IDX4559"></A>
<CODE>streams</CODE>.

</UL>

</UL>

</div class="cartouche">



<H2><A NAME="SEC337" HREF="ciao_toc.html#TOC337">Documentation on exports (<CODE>file_utils</CODE>)</A></H2>
<P>
<A NAME="IDX4560"></A>
<A NAME="IDX4561"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>file_terms/2:</B>
<DD><A NAME="IDX4562"></A>


<P>
<STRONG>Usage 1:</STRONG> <CODE>file_terms(@File, ?Terms)</CODE>

<UL>
<LI><EM>Description:</EM> Transform a file <CODE>File</CODE> to/from a list of terms <CODE>Terms</CODE>.

<LI><EM>The following properties should hold upon exit:</EM>

<CODE>@File</CODE> is a source name.
 (<CODE>streams_basic:sourcename/1</CODE>)

<CODE>?Terms</CODE> is a list.
 (<CODE>basic_props:list/1</CODE>)
</UL>

<P>
<STRONG>Usage 2:</STRONG> <CODE>file_terms(File, Terms)</CODE>

<UL>
<LI><EM>Description:</EM> Unifies <CODE>Terms</CODE> with the list of all terms in <CODE>File</CODE>.

<LI><EM>The following properties should hold at call time:</EM>

<CODE>File</CODE> is a source name.
 (<CODE>streams_basic:sourcename/1</CODE>)

<CODE>Terms</CODE> is a free variable.
 (<CODE>term_typing:var/1</CODE>)
<LI><EM>The following properties should hold upon exit:</EM>

<CODE>File</CODE> is a source name.
 (<CODE>streams_basic:sourcename/1</CODE>)

<CODE>Terms</CODE> is a list.
 (<CODE>basic_props:list/1</CODE>)
</UL>

<P>
<STRONG>Usage 3:</STRONG> <CODE>file_terms(File, Terms)</CODE>

<UL>
<LI><EM>Description:</EM> Writes the terms in list <CODE>Terms</CODE> (including the ending '.') onto file <CODE>File</CODE>.

<LI><EM>The following properties should hold at call time:</EM>

<CODE>File</CODE> is a source name.
 (<CODE>streams_basic:sourcename/1</CODE>)

<CODE>Terms</CODE> is a list.
 (<CODE>basic_props:list/1</CODE>)
<LI><EM>The following properties should hold upon exit:</EM>

<CODE>File</CODE> is a source name.
 (<CODE>streams_basic:sourcename/1</CODE>)

<CODE>Terms</CODE> is a list.
 (<CODE>basic_props:list/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX4563"></A>
<A NAME="IDX4564"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>copy_stdout/1:</B>
<DD><A NAME="IDX4565"></A>


<P>
<STRONG>Usage:</STRONG> <CODE>copy_stdout(+File)</CODE>

<UL>
<LI><EM>Description:</EM> Copies file <CODE>File</CODE> to standard output.

<LI><EM>The following properties should hold upon exit:</EM>

<CODE>+File</CODE> is a source name.
 (<CODE>streams_basic:sourcename/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX4566"></A>
<A NAME="IDX4567"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>file_to_string/2:</B>
<DD><A NAME="IDX4568"></A>


<P>
<STRONG>Usage:</STRONG> <CODE>file_to_string(+FileName, -String)</CODE>

<UL>
<LI><EM>Description:</EM> Reads all the characters from the file <CODE>FileName</CODE> and returns them in <CODE>String</CODE>.

<LI><EM>Call and exit should be <EM>compatible</EM> with:</EM>

<CODE>+FileName</CODE> is a source name.
 (<CODE>streams_basic:sourcename/1</CODE>)

<CODE>-String</CODE> is a string (a list of character codes).
 (<CODE>basic_props:string/1</CODE>)
</UL>

</DL>

<P>
<A NAME="IDX4569"></A>
<A NAME="IDX4570"></A>
<DL>
<DT><span class="define">PREDICATE:</span> <B>stream_to_string/2:</B>
<DD><A NAME="IDX4571"></A>


<P>
<STRONG>Usage:</STRONG> <CODE>stream_to_string(+Stream, -String)</CODE>

<UL>
<LI><EM>Description:</EM> Reads all the characters from <CODE>Stream</CODE> and returns them in <CODE>String</CODE>.

<LI><EM>Call and exit should be <EM>compatible</EM> with:</EM>

<CODE>+Stream</CODE> is an open stream.
 (<CODE>streams_basic:stream/1</CODE>)

<CODE>-String</CODE> is a string (a list of character codes).
 (<CODE>basic_props:string/1</CODE>)
</UL>

</DL>

<P><HR><P>
Go to the <A HREF="ciao_1.html">first</A>, <A HREF="ciao_77.html">previous</A>, <A HREF="ciao_79.html">next</A>, <A HREF="ciao_241.html">last</A> section, <A HREF="ciao_toc.html">table of contents</A>.
</BODY>
</HTML>