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

📄 unit-posix.html

📁 Scheme跨平台编译器
💻 HTML
📖 第 1 页 / 共 4 页
字号:
</PRE><a name="fifos"></a><h2>Fifos</h2><a name="create-fifo"></a><h3>create-fifo</h3><pre>[procedure] (create-fifo FILENAME [MODE])</pre><p>Creates a FIFO with the name <tt>FILENAME</tt> and the permission bits <tt>MODE</tt>, which defaults to</p><PRE> [procedure] (+ perm/irwxu perm/irwxg perm/irwxo)</PRE><a name="fifo"></a><h3>fifo?</h3><pre>[procedure] (fifo? FILENAME)</pre><p>Returns <tt>#t</tt> if the file with the name <tt>FILENAME</tt> names a FIFO.</p><a name="file-descriptors-and-low-level-i-o"></a><h2>File descriptors and low-level I/O</h2><a name="duplicate-fileno"></a><h3>duplicate-fileno</h3><pre>[procedure] (duplicate-fileno OLD [NEW])</pre><p>If <tt>NEW</tt> is given, then the file-descriptor <tt>NEW</tt> is opened to access the file with the file-descriptor <tt>OLD</tt>. Otherwise a fresh file-descriptor accessing the same file as <tt>OLD</tt> is returned.</p><a name="file-close"></a><h3>file-close</h3><pre>[procedure] (file-close FILENO)</pre><p>Closes the input/output file with the file-descriptor <tt>FILENO</tt>.</p><a name="file-open"></a><h3>file-open</h3><pre>[procedure] (file-open FILENAME FLAGS [MODE])</pre><p>Opens the file specified with the string <tt>FILENAME</tt> and open-flags <tt>FLAGS</tt> using the C function <tt>open()</tt>. On success a file-descriptor for the opened file is returned.  <tt>FLAGS</tt> should be a bitmask containing one or more of the <tt>open/...</tt> values <strong>or</strong>ed together using <tt>bitwise-ior</tt> (or simply added together).  The optional <tt>MODE</tt> should be a bitmask composed of one or more permission values like <tt>perm/irusr</tt> and is only relevant when a new file is created. The default mode is <tt>perm/irwxu | perm/irgrp | perm/iroth</tt>.</p><a name="file-mkstemp"></a><h3>file-mkstemp</h3><pre>[procedure] (file-mkstemp TEMPLATE-FILENAME)</pre><p>Create a file based on the given <tt>TEMPLATE-FILENAME</tt>, in which the six last characters must be <em>XXXXXX</em>.  These will be replaced with a string that makes the filename unique.  The file descriptor of the created file and the generated filename is returned.  See the <tt>mkstemp(3)</tt> manual page for details on how this function works.  The template string given is not modified.</p><p>Example usage:</p><PRE> (let-values (((fd temp-path) (file-mkstemp <B><FONT COLOR="#BC8F8F">&quot;/tmp/mytemporary.XXXXXX&quot;</FONT></B>)))  (<B><FONT COLOR="#A020F0">let</FONT></B> ((temp-port (open-output-file* fd)))    (format temp-port <B><FONT COLOR="#BC8F8F">&quot;This file is ~A.~%&quot;</FONT></B> temp-path)    (close-output-port temp-port)))</PRE><a name="file-read"></a><h3>file-read</h3><pre>[procedure] (file-read FILENO SIZE [BUFFER])</pre><p>Reads <tt>SIZE</tt> bytes from the file with the file-descriptor <tt>FILENO</tt>.  If a string or bytevector is passed in the optional argument <tt>BUFFER</tt>, then this string will be destructively modified to contain the read data. This procedure returns a list with two values: the buffer containing the data and the number of bytes read.</p><a name="file-select"></a><h3>file-select</h3><pre>[procedure] (file-select READFDLIST WRITEFDLIST [TIMEOUT])</pre><p>Waits until any of the file-descriptors given in the lists <tt>READFDLIST</tt> and <tt>WRITEFDLIST</tt> is ready for input or output, respectively. If the optional argument <tt>TIMEOUT</tt> is given and not false, then it should specify the number of seconds after which the wait is to be aborted (the value may be a floating point number). This procedure returns two values: the lists of file-descriptors ready for input and output, respectively. <tt>READFDLIST</tt> and <strong>WRITEFDLIST</strong> may also by file-descriptors instead of lists.  In this case the returned values are booleans indicating whether input/output is ready by <tt>#t</tt> or <tt>#f</tt> otherwise.  You can also pass <tt>#f</tt> as <tt>READFDLIST</tt> or <tt>WRITEFDLIST</tt> argument, which is equivalent to <tt>()</tt>.</p><a name="file-write"></a><h3>file-write</h3><pre>[procedure] (file-write FILENO BUFFER [SIZE])</pre><p>Writes the contents of the string or bytevector <tt>BUFFER</tt> into the file with the file-descriptor <tt>FILENO</tt>. If the optional argument <tt>SIZE</tt> is given, then only the specified number of bytes are written.</p><a name="file-control"></a><h3>file-control</h3><pre>[procedure] (file-control FILENO COMMAND [ARGUMENT])</pre><p>Performs the fcntl operation <tt>COMMAND</tt> with the given <tt>FILENO</tt> and optional <tt>ARGUMENT</tt>. The return value is meaningful depending on the <tt>COMMAND</tt>.</p><a name="open-input-file"></a><h3>open-input-file*</h3><a name="open-output-file"></a><h3>open-output-file*</h3><pre>[procedure] (open-input-file* FILENO [OPENMODE])[procedure] (open-output-file* FILENO [OPENMODE])</pre><p>Opens file for the file-descriptor <tt>FILENO</tt> for input or output and returns a port.  <tt>FILENO</tt> should be a positive exact integer. <tt>OPENMODE</tt> specifies an additional mode for opening the file (currently only the keyword <tt>#:append</tt> is supported, which opens an output-file for appending).</p><a name="port-fileno"></a><h3>port&rarr;fileno</h3><pre>[procedure] (port-&gt;fileno PORT)</pre><p>If <tt>PORT</tt> is a file- or tcp-port, then a file-descriptor is returned for this port. Otherwise an error is signaled.</p><a name="retrieving-file-attributes"></a><h2>Retrieving file attributes</h2><a name="file-access-time"></a><h3>file-access-time</h3><a name="file-change-time"></a><h3>file-change-time</h3><a name="file-modification-time"></a><h3>file-modification-time</h3><pre>[procedure] (file-access-time FILE)[procedure] (file-change-time FILE)[procedure] (file-modification-time FILE)</pre><p>Returns time (in seconds) of the last access, modification or change of <tt>FILE</tt>. <tt>FILE</tt> may be a filename or a file-descriptor. If the file does not exist, an error is signaled.</p><a name="file-stat"></a><h3>file-stat</h3><pre>[procedure] (file-stat FILE [LINK])</pre><p>Returns a 13-element vector with the following contents: inode-number, mode (as with <tt>file-permissions</tt>), number of hard links, uid of owner (as with <tt>file-owner</tt>), gid of owner, size (as with <tt>file-size</tt>) and access-, change- and modification-time (as with <tt>file-access-time</tt>, <tt>file-change-time</tt> and <tt>file-modification-time</tt>, device id, device type (for special file inode, blocksize and blocks allocated.  On Windows systems the last 4 values are undefined.  If the optional argument <tt>LINK</tt> is given and not <tt>#f</tt>, then the file-statistics vector will be resolved for symbolic links (otherwise symbolic links are not resolved). Note that for very large files, the <tt>file-size</tt> value may be an inexact integer.</p><a name="file-position"></a><h3>file-position</h3><pre>[procedure] (file-position FILE)</pre><p>Returns the current file position of <tt>FILE</tt>, which should be a port or a file-descriptor.</p><a name="file-size"></a><h3>file-size</h3><pre>[procedure] (file-size FILENAME)</pre><p>Returns the size of the file designated by <tt>FILE</tt>.  <tt>FILE</tt> may be a filename or a file-descriptor.  If the file does not exist, an error is signaled. Note that for very large files, <tt>file-size</tt> may return an inexact integer.</p><a name="regular-file"></a><h3>regular-file?</h3><pre>[procedure] (regular-file? FILENAME)</pre><p>Returns true, if <tt>FILENAME</tt> names a regular file (not a directory or symbolic link).</p><a name="file-owner"></a><h3>file-owner</h3><pre>[procedure] (file-owner FILE)</pre><p>Returns the user-id of <tt>FILE</tt>.  <tt>FILE</tt> may be a filename or a file-descriptor.</p><a name="file-permissions"></a><h3>file-permissions</h3><pre>[procedure] (file-permissions FILE)</pre><p>Returns the permission bits for <tt>FILE</tt>. You can test this value by performing bitwise operations on the result and the <tt>perm/...</tt> values.  <tt>FILE</tt> may be a filename or a file-descriptor.</p><a name="file-read-access"></a><h3>file-read-access?</h3><a name="file-write-access"></a><h3>file-write-access?</h3><a name="file-execute-access"></a><h3>file-execute-access?</h3><pre>[procedure] (file-read-access? FILENAME)[procedure] (file-write-access? FILENAME)[procedure] (file-execute-access? FILENAME)</pre><p>These procedures return <tt>#t</tt> if the current user has read, write or execute permissions on the file named <tt>FILENAME</tt>.</p><a name="stat-regular"></a><h3>stat-regular?</h3><a name="stat-directory"></a><h3>stat-directory?</h3><a name="stat-char-device"></a><h3>stat-char-device?</h3><a name="stat-block-device"></a><h3>stat-block-device?</h3><a name="stat-fifo"></a><h3>stat-fifo?</h3><a name="stat-symlink"></a><h3>stat-symlink?</h3><a name="stat-socket"></a><h3>stat-socket?</h3><pre>[procedure] (stat-regular? FILENAME)[procedure] (stat-directory? FILENAME)[procedure] (stat-char-device? FILENAME)[procedure] (stat-block-device? FILENAME)[procedure] (stat-fifo? FILENAME)

⌨️ 快捷键说明

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