<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.dio.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.dio-open.php',
    1 => 'dio_open',
    2 => 'Apre un nuovo file nella modalit&agrave; specificata da flags e
   i permessi indicati in mode',
  ),
  'up' => 
  array (
    0 => 'ref.dio.php',
    1 => 'Direct IO Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.dio-fcntl.php',
    1 => 'dio_fcntl',
  ),
  'next' => 
  array (
    0 => 'function.dio-read.php',
    1 => 'dio_read',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'it',
    'path' => 'reference/dio/functions/dio-open.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.dio-open" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">dio_open</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.2.0, PHP 5 &lt; 5.1.0)</p><p class="refpurpose"><span class="refname">dio_open</span> &mdash; <span class="dc-title">
   Apre un nuovo file nella modalità specificata da flags e
   i permessi indicati in mode
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.dio-open-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>dio_open</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$filename</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$flags</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = ?</span></span>): <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></div>

  <p class="para rdfs-comment">
   La funzione <span class="function"><strong>dio_open()</strong></span> apre un file e restituisce un nuovo descrittore di file
   per questo. 
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.dio-open-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">filename</code></dt>
     <dd>
      <p class="para">
       Il file aperto.
      </p>
     </dd>
    
    
     <dt><code class="parameter">flags</code></dt>
     <dd>
      <p class="para">
       Il parametro <code class="parameter">flags</code> può contenere qualsiasi combinazione
       dei seguenti valori:
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          <strong><code><a href="dio.constants.php#constant.o-creat">O_CREAT</a></code></strong> - crea un file, se questo 
          non esiste già.
         </p>
        </li> 
        <li class="listitem">
         <p class="para">
          <strong><code><a href="dio.constants.php#constant.o-excl">O_EXCL</a></code></strong>  - se sono impostati sia <strong><code><a href="dio.constants.php#constant.o-creat">O_CREAT</a></code></strong>
          e sia <strong><code><a href="dio.constants.php#constant.o-excl">O_EXCL</a></code></strong>,
          la funzione <span class="function"><strong>dio_open()</strong></span> fallisce se il file esiste.        
         </p>
        </li> 
        <li class="listitem">
         <p class="para">
          <strong><code><a href="dio.constants.php#constant.o-trunc">O_TRUNC</a></code></strong> - se il file esiste, ed è aperto in scrittura,
          il file verrà portato a lunghezza zero.
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="dio.constants.php#constant.o-append">O_APPEND</a></code></strong> - nelle operazioni di scrittura, scrive i dati
          alla fine del file.
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="dio.constants.php#constant.o-nonblock">O_NONBLOCK</a></code></strong> - imposta la modalità non blocking.
         </p>
        </li>
       </ul>
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       Se <code class="parameter">flags</code> vale <strong><code><a href="dio.constants.php#constant.o-creat">O_CREAT</a></code></strong>,
       allora il parametro <code class="parameter">mode</code> imposta la modalità del file
       (permessi di creazione).  
       <ul class="itemizedlist">
        <li class="listitem">
         <p class="para">
          <strong><code><a href="dio.constants.php#constant.o-rdonly">O_RDONLY</a></code></strong> - apre il file per accessi in lettura.
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="dio.constants.php#constant.o-wronly">O_WRONLY</a></code></strong> - apre il file in scrittura.
         </p>
        </li>
        <li class="listitem">
         <p class="para">
          <strong><code><a href="dio.constants.php#constant.o-rdwr">O_RDWR</a></code></strong> - apre il file sia in lettura sia
          in scrittura.
         </p>
        </li>
       </ul>
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.dio-open-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   Restituisce un descrittore di file, oppure <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di errore.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-function.dio-open-examples">
  <h3 class="title">Esempi</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 Apertura di un descrittore di file</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$fd </span><span style="color: #007700">= </span><span style="color: #0000BB">dio_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'/dev/ttyS0'</span><span style="color: #007700">, </span><span style="color: #0000BB">O_RDWR </span><span style="color: #007700">| </span><span style="color: #0000BB">O_NOCTTY </span><span style="color: #007700">| </span><span style="color: #0000BB">O_NONBLOCK</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">dio_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$fd</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>    
 </div>

 <div class="refsect1 seealso" id="refsect1-function.dio-open-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.dio-close.php" class="function" rel="rdfs-seeAlso">dio_close()</a> - Chiude il descrittore di file dato da fd</span></li>
   </ul>
  </p>
 </div>

</div><?php manual_footer($setup); ?>