Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 3e60ff9d4d6f58c8fbd17208f14089fa > files > 370

octave-doc-3.2.3-3mdv2010.0.i586.rpm

<html lang="en">
<head>
<title>Simple Output - Untitled</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Untitled">
<meta name="generator" content="makeinfo 4.13">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="C_002dStyle-I_002fO-Functions.html#C_002dStyle-I_002fO-Functions" title="C-Style I/O Functions">
<link rel="prev" href="Opening-and-Closing-Files.html#Opening-and-Closing-Files" title="Opening and Closing Files">
<link rel="next" href="Line_002dOriented-Input.html#Line_002dOriented-Input" title="Line-Oriented Input">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
--></style>
</head>
<body>
<div class="node">
<a name="Simple-Output"></a>
<p>
Next:&nbsp;<a rel="next" accesskey="n" href="Line_002dOriented-Input.html#Line_002dOriented-Input">Line-Oriented Input</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="Opening-and-Closing-Files.html#Opening-and-Closing-Files">Opening and Closing Files</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="C_002dStyle-I_002fO-Functions.html#C_002dStyle-I_002fO-Functions">C-Style I/O Functions</a>
<hr>
</div>

<h4 class="subsection">14.2.2 Simple Output</h4>

<p>Once a file has been opened for writing a string can be written to the
file using the <code>fputs</code> function.  The following example shows
how to write the string &lsquo;<samp><span class="samp">Free Software is needed for Free Science</span></samp>&rsquo;
to the file &lsquo;<samp><span class="samp">free.txt</span></samp>&rsquo;.

<pre class="example">     filename = "free.txt";
     fid = fopen (filename, "w");
     fputs (fid, "Free Software is needed for Free Science");
     fclose (fid);
</pre>
   <!-- file-io.cc -->
   <p><a name="doc_002dfputs"></a>

<div class="defun">
&mdash; Built-in Function:  <b>fputs</b> (<var>fid, string</var>)<var><a name="index-fputs-777"></a></var><br>
<blockquote><p>Write a string to a file with no formatting.

        <p>Return a non-negative number on success and EOF on error. 
<!-- Texinfo @sp should work but in practice produces ugly results for HTML. -->
<!-- A simple blank line produces the correct behavior. -->
<!-- @sp 1 -->

     <p class="noindent"><strong>See also:</strong> <a href="doc_002dscanf.html#doc_002dscanf">scanf</a>, <a href="doc_002dsscanf.html#doc_002dsscanf">sscanf</a>, <a href="doc_002dfread.html#doc_002dfread">fread</a>, <a href="doc_002dfprintf.html#doc_002dfprintf">fprintf</a>, <a href="doc_002dfgets.html#doc_002dfgets">fgets</a>, <a href="doc_002dfscanf.html#doc_002dfscanf">fscanf</a>. 
</p></blockquote></div>

   <p>A function much similar to <code>fputs</code> is available for writing data
to the screen.  The <code>puts</code> function works just like <code>fputs</code>
except it doesn't take a file pointer as its input.

<!-- file-io.cc -->
   <p><a name="doc_002dputs"></a>

<div class="defun">
&mdash; Built-in Function:  <b>puts</b> (<var>string</var>)<var><a name="index-puts-778"></a></var><br>
<blockquote><p>Write a string to the standard output with no formatting.

        <p>Return a non-negative number on success and EOF on error. 
</p></blockquote></div>

   </body></html>