⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 file.html

📁 perl教程
💻 HTML
📖 第 1 页 / 共 5 页
字号:
            e -- Existing file only (fail if doesn't exist)
      ''   is the same as 'q  k e'
      'r'  is the same as 'r  k e'
      'w'  is the same as 'w  t c'
      'rw' is the same as 'rw k c'
      'rt' or 'rn' implies 'c'.
      Or $access can be numeric.</pre>
</dd>
<dd>
<p><code>$svAccess</code> is designed to be &quot;do what I mean&quot;, so you can skip
the rest of its explanation unless you are interested in the complex
details.  Note that, if you want write access to a device, you need
to specify <a href="#item__22k_22"><code>&quot;k&quot;</code></a> [and perhaps <a href="#item__22e_22"><code>&quot;e&quot;</code></a>, as in <code>&quot;w ke&quot;</code> or <code>&quot;rw ke&quot;</code>]
since Win32 suggests <code>OPEN_EXISTING</code> be used when opening a device.</p>
</dd>
<dl>
<dt><strong><a name="item__22q_22"><code>&quot;q&quot;</code></a></strong>

<dd>
<p>Stands for &quot;Query access&quot;.  This is really a no-op since you always have
query access when you open a file.  You can specify <a href="#item__22q_22"><code>&quot;q&quot;</code></a> to document
that you plan to query the file [or device, etc.].  This is especially
helpful when you don't want read nor write access since something like
<a href="#item__22q_22"><code>&quot;q&quot;</code></a> or <code>&quot;q ke&quot;</code> may be easier to understand than just <code>&quot;&quot;</code> or <a href="#item__22ke_22"><code>&quot;ke&quot;</code></a>.</p>
</dd>
</li>
<dt><strong><code>&quot;r&quot;</code></strong>

<dd>
<p>Stands for &quot;Read access&quot;.  Sets the <code>GENERIC_READ</code> <code>bit(s)</code> in the
<code>$uAccess</code> that is passed to <a href="#item_createfile"><code>CreateFile</code></a>.  This is the default
access if the <code>$svAccess</code> parameter is missing [or if it is <a href="../../lib/Pod/perlfunc.html#item_undef"><code>undef</code></a>
and <code>$rvhvOptions</code> doesn't specify an <code>&quot;Access&quot;</code> option].</p>
</dd>
</li>
<dt><strong><a name="item__22w_22"><code>&quot;w&quot;</code></a></strong>

<dd>
<p>Stands for &quot;Write access&quot;.  Sets the <code>GENERIC_WRITE</code> <code>bit(s)</code> in the
<code>$uAccess</code> that is passed to <a href="#item_createfile"><code>CreateFile</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item__22k_22"><code>&quot;k&quot;</code></a></strong>

<dd>
<p>Stands for &quot;Keep if exists&quot;.  If the requested file exists, then it is
opened.  This is the default unless <code>GENERIC_WRITE</code> access has been
requested but <code>GENERIC_READ</code> access has not been requested.   Contrast
with <a href="#item__22t_22"><code>&quot;t&quot;</code></a> and <a href="#item__22n_22"><code>&quot;n&quot;</code></a>.</p>
</dd>
</li>
<dt><strong><code>&quot;t&quot;</code></strong>

<dd>
<p>Stands for &quot;Truncate if exists&quot;.  If the requested file exists, then
it is truncated to zero length and then opened.  This is the default if
<code>GENERIC_WRITE</code> access has been requested and <code>GENERIC_READ</code> access
has not been requested.  Contrast with <a href="#item__22k_22"><code>&quot;k&quot;</code></a> and <a href="#item__22n_22"><code>&quot;n&quot;</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item__22n_22"><code>&quot;n&quot;</code></a></strong>

<dd>
<p>Stands for &quot;New file only&quot;.  If the requested file exists, then it is
not opened and the <a href="#item_createfile"><code>createFile</code></a> call fails.  Contrast with <a href="#item__22k_22"><code>&quot;k&quot;</code></a> and
<a href="#item__22t_22"><code>&quot;t&quot;</code></a>.  Can't be used with <a href="#item__22e_22"><code>&quot;e&quot;</code></a>.</p>
</dd>
</li>
<dt><strong><code>&quot;c&quot;</code></strong>

<dd>
<p>Stands for &quot;Create if none&quot;.  If the requested file does not
exist, then it is created and then opened.  This is the default
if <code>GENERIC_WRITE</code> access has been requested or if <a href="#item__22t_22"><code>&quot;t&quot;</code></a> or
<a href="#item__22n_22"><code>&quot;n&quot;</code></a> was specified.  Contrast with <a href="#item__22e_22"><code>&quot;e&quot;</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item__22e_22"><code>&quot;e&quot;</code></a></strong>

<dd>
<p>Stands for &quot;Existing file only&quot;.  If the requested file does not
exist, then nothing is opened and the <a href="#item_createfile"><code>createFile</code></a> call fails.  This
is the default unless <code>GENERIC_WRITE</code> access has been requested or
<a href="#item__22t_22"><code>&quot;t&quot;</code></a> or <a href="#item__22n_22"><code>&quot;n&quot;</code></a> was specified.   Contrast with <a href="#item__22c_22"><code>&quot;c&quot;</code></a>.   Can't be
used with <a href="#item__22n_22"><code>&quot;n&quot;</code></a>.</p>
</dd>
</li>
</dl>
<p>The characters from <code>&quot;ktn&quot;</code> and <code>&quot;ce&quot;</code> are combined to determine the
what value for <code>$uCreate</code> to pass to <a href="#item_createfile"><code>CreateFile</code></a> [unless overridden
by <code>$rvhvOptions</code>]:</p>
<dl>
<dt><strong><a name="item__22kc_22"><code>&quot;kc&quot;</code></a></strong>

<dd>
<p><code>OPEN_ALWAYS</code></p>
</dd>
</li>
<dt><strong><a name="item__22ke_22"><code>&quot;ke&quot;</code></a></strong>

<dd>
<p><code>OPEN_EXISTING</code></p>
</dd>
</li>
<dt><strong><a name="item__22tc_22"><code>&quot;tc&quot;</code></a></strong>

<dd>
<p><code>TRUNCATE_EXISTING</code></p>
</dd>
</li>
<dt><strong><a name="item__22te_22"><code>&quot;te&quot;</code></a></strong>

<dd>
<p><code>CREATE_ALWAYS</code></p>
</dd>
</li>
<dt><strong><a name="item__22nc_22"><code>&quot;nc&quot;</code></a></strong>

<dd>
<p><code>CREATE_NEW</code></p>
</dd>
</li>
<dt><strong><a name="item__22ne_22"><code>&quot;ne&quot;</code></a></strong>

<dd>
<p>Illegal.</p>
</dd>
</li>
</dl>
<p><code>$svShare</code> controls how the file is shared, that is, whether other
processes can have read, write, and/or delete access to the file while
we have it opened.  <code>$svShare</code> will usually be a string containing zero
or more characters from <code>&quot;rwd&quot;</code> but can also be a numeric bit mask.</p>
<p><a href="#item__22r_22"><code>&quot;r&quot;</code></a> sets the <code>FILE_SHARE_READ</code> bit which allows other processes to have
read access to the file.  <a href="#item__22w_22"><code>&quot;w&quot;</code></a> sets the <code>FILE_SHARE_WRITE</code> bit which
allows other processes to have write access to the file.  <code>&quot;d&quot;</code> sets the
<code>FILE_SHARE_DELETE</code> bit which allows other processes to have delete access
to the file [ignored under Windows 95].</p>
<p>The default for <code>$svShare</code> is <code>&quot;rw&quot;</code> which provides the same sharing as
using regular perl <a href="../../lib/Pod/perlfunc.html#item_open"><code>open()</code></a>.</p>
<p>If another process currently has read, write, and/or delete access to
the file and you don't allow that level of sharing, then your call to
<a href="#item_createfile"><code>createFile</code></a> will fail.  If you requested read, write, and/or delete
access and another process already has the file open but doesn't allow
that level of sharing, then your call to <a href="#item_createfile"><code>createFile</code></a> will fail.  Once
you have the file open, if another process tries to open it with read,
write, and/or delete access and you don't allow that level of sharing,
then that process won't be allowed to open the file.</p>
<p><code>$rvhvOptions</code> is a reference to a hash where any keys must be from
the list <code>qw( Access Create Share Attributes Flags Security Model )</code>.
The meaning of the value depends on the key name, as described below.
Any option values in <code>$rvhvOptions</code> override the settings from
<code>$svAccess</code> and <code>$svShare</code> if they conflict.</p>
<dl>
<dt><strong><a name="item_flags__3d_3e__24uflags">Flags =&gt; $uFlags</a></strong>

<dd>
<p><code>$uFlags</code> is an unsigned value having any of the <code>FILE_FLAG_*</code> or
<code>FILE_ATTRIBUTE_*</code> bits set.  Any <code>FILE_ATTRIBUTE_*</code> bits set via the
<code>Attributes</code> option are logically <code>or</code>ed with these bits.  Defaults
to <code>0</code>.</p>
</dd>
<dd>
<p>If opening the client side of a named pipe, then you can also specify
<code>SECURITY_SQOS_PRESENT</code> along with one of the other <code>SECURITY_*</code>
constants to specify the security quality of service to be used.</p>
</dd>
</li>
<dt><strong><a name="item_attributes__3d_3e__24sattributes">Attributes =&gt; $sAttributes</a></strong>

<dd>
<p>A string of zero or more characters from <code>&quot;achorst&quot;</code> [see <a href="#item_attrletstobits"><code>attrLetsToBits</code></a>
for more information] which are converted to <code>FILE_ATTRIBUTE_*</code> bits to
be set in the <code>$uFlags</code> argument passed to <a href="#item_createfile"><code>CreateFile</code></a>.</p>
</dd>
</li>
<dt><strong><a name="item_security__3d_3e__24psecurityattributes">Security =&gt; $pSecurityAttributes</a></strong>

<dd>
<p><code>$pSecurityAttributes</code> should contain a <code>SECURITY_ATTRIBUTES</code> structure
packed into a string or <code>[]</code> [the default].</p>
</dd>
</li>
<dt><strong><a name="item_model__3d_3e__24hmodelfile">Model =&gt; $hModelFile</a></strong>

<dd>
<p><code>$hModelFile</code> should contain a handle opened with <code>GENERIC_READ</code>
access to a model file from which file attributes and extended attributes
are to be copied.  Or <code>$hModelFile</code> can be <code>0</code> [the default].</p>
</dd>
</li>
<dt><strong><a name="item_access__3d_3e__24saccess">Access =&gt; $sAccess</a></strong>

<dt><strong><a name="item_access__3d_3e__24uaccess">Access =&gt; $uAccess</a></strong>

<dd>
<p><code>$sAccess</code> should be a string of zero or more characters from
<code>&quot;qrw&quot;</code> specifying the type of access desired:  &quot;query&quot; or <code>0</code>,
&quot;read&quot; or <code>GENERIC_READ</code> [the default], or &quot;write&quot; or
<code>GENERIC_WRITE</code>.</p>
</dd>
<dd>
<p><code>$uAccess</code> should be an unsigned value containing bits set to
indicate the type of access desired.  <code>GENERIC_READ</code> is the default.</p>
</dd>
</li>
<dt><strong><a name="item_create__3d_3e__24screate">Create =&gt; $sCreate</a></strong>

<dt><strong><a name="item_create__3d_3e__24ucreate">Create =&gt; $uCreate</a></strong>

<dd>
<p><code>$sCreate</code> should be a string constaing zero or one character from
<code>&quot;ktn&quot;</code> and zero or one character from <code>&quot;ce&quot;</code>.  These stand for
&quot;Keep if exists&quot;, &quot;Truncate if exists&quot;, &quot;New file only&quot;, &quot;Create if
none&quot;, and &quot;Existing file only&quot;.  These are translated into a
<code>$uCreate</code> value.</p>
</dd>
<dd>
<p><code>$uCreate</code> should be one of <code>OPEN_ALWAYS</code>, <code>OPEN_EXISTING</code>,
<code>TRUNCATE_EXISTING</code>, <code>CREATE_ALWAYS</code>, or <code>CREATE_NEW</code>.</p>
</dd>
</li>
<dt><strong><a name="item_share__3d_3e__24sshare">Share =&gt; $sShare</a></strong>

<dt><strong><a name="item_share__3d_3e__24ushare">Share =&gt; $uShare</a></strong>

<dd>
<p><code>$sShare</code> should be a string with zero or more characters from
<code>&quot;rwd&quot;</code> that is translated into a <code>$uShare</code> value.  <code>&quot;rw&quot;</code> is
the default.</p>
</dd>
<dd>
<p><code>$uShare</code> should be an unsigned value having zero or more of the
following bits set:  <code>FILE_SHARE_READ</code>, <code>FILE_SHARE_WRITE</code>, and
<code>FILE_SHARE_DELETE</code>.  <code>FILE_SHARE_READ|FILE_SHARE_WRITE</code> is the
default.</p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -