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

📄 iolib.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/ioLib.html - generated by refgen from ioLib.c --> <title> ioLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.html"><i>VxWorks Reference Manual :  Libraries</i></a></p></blockquote><h1>ioLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>ioLib</strong> - I/O interface library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><i><a href="./ioLib.html#creat">creat</a></i>(&nbsp;)</b>  -  create a file<br><b><i><a href="./ioLib.html#unlink">unlink</a></i>(&nbsp;)</b>  -  delete a file (POSIX)<br><b><i><a href="./ioLib.html#remove">remove</a></i>(&nbsp;)</b>  -  remove a file (ANSI)<br><b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b>  -  open a file<br><b><i><a href="./ioLib.html#close">close</a></i>(&nbsp;)</b>  -  close a file<br><b><i><a href="./ioLib.html#rename">rename</a></i>(&nbsp;)</b>  -  change the name of a file<br><b><i><a href="./ioLib.html#read">read</a></i>(&nbsp;)</b>  -  read bytes from a file or device<br><b><i><a href="./ioLib.html#write">write</a></i>(&nbsp;)</b>  -  write bytes to a file<br><b><i><a href="./ioLib.html#ioctl">ioctl</a></i>(&nbsp;)</b>  -  perform an I/O control function<br><b><i><a href="./ioLib.html#lseek">lseek</a></i>(&nbsp;)</b>  -  set a file read/write pointer<br><b><i><a href="./ioLib.html#ioDefPathSet">ioDefPathSet</a></i>(&nbsp;)</b>  -  set the current default path<br><b><i><a href="./ioLib.html#ioDefPathGet">ioDefPathGet</a></i>(&nbsp;)</b>  -  get the current default path<br><b><i><a href="./ioLib.html#chdir">chdir</a></i>(&nbsp;)</b>  -  set the current default path<br><b><i><a href="./ioLib.html#getcwd">getcwd</a></i>(&nbsp;)</b>  -  get the current default path (POSIX)<br><b><i><a href="./ioLib.html#getwd">getwd</a></i>(&nbsp;)</b>  -  get the current default path<br><b><i><a href="./ioLib.html#ioGlobalStdSet">ioGlobalStdSet</a></i>(&nbsp;)</b>  -  set the file descriptor for global standard input/output/error<br><b><i><a href="./ioLib.html#ioGlobalStdGet">ioGlobalStdGet</a></i>(&nbsp;)</b>  -  get the file descriptor for global standard input/output/error<br><b><i><a href="./ioLib.html#ioTaskStdSet">ioTaskStdSet</a></i>(&nbsp;)</b>  -  set the file descriptor for task standard input/output/error<br><b><i><a href="./ioLib.html#ioTaskStdGet">ioTaskStdGet</a></i>(&nbsp;)</b>  -  get the file descriptor for task standard input/output/error<br><b><i><a href="./ioLib.html#isatty">isatty</a></i>(&nbsp;)</b>  -  return whether the underlying driver is a tty device<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library contains the interface to the basic I/O system.It includes:<ul><li>Interfaces to the seven basic driver-provided functions:<b><i><a href="./ioLib.html#creat">creat</a></i>(&nbsp;)</b>, <b><i><a href="./ioLib.html#remove">remove</a></i>(&nbsp;)</b>, <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b>, <b><i><a href="./ioLib.html#close">close</a></i>(&nbsp;)</b>, <b><i><a href="./ioLib.html#read">read</a></i>(&nbsp;)</b>, <b><i><a href="./ioLib.html#write">write</a></i>(&nbsp;)</b>, and <b><i><a href="./ioLib.html#ioctl">ioctl</a></i>(&nbsp;)</b>.</li><li>Interfaces to several file system functions, including<b><i><a href="./ioLib.html#rename">rename</a></i>(&nbsp;)</b> and <b><i><a href="./ioLib.html#lseek">lseek</a></i>(&nbsp;)</b>.</li><li>Routines to set and get the current working directory.</li><li>Routines to assign task and global standard file descriptors.</ul><p></blockquote><h4>FILE DESCRIPTORS</h4><blockquote><p><p>At the basic I/O level, files are referred to by a file descriptor.A file descriptor is a small integer returned by a call to <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b> or <b><i><a href="./ioLib.html#creat">creat</a></i>(&nbsp;)</b>.  The other basic I/O calls take a file descriptor as a parameter to specify the intended file.<p>Three file descriptors are reserved and have special meanings:<p>&nbsp;&nbsp;&nbsp;&nbsp;0&nbsp;(<b>STD_IN</b>)&nbsp;&nbsp;-&nbsp;standard&nbsp;input<br>&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;(<b>STD_OUT</b>)&nbsp;-&nbsp;standard&nbsp;output<br>&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;(<b>STD_ERR</b>)&nbsp;-&nbsp;standard&nbsp;error&nbsp;output<p>VxWorks allows two levels of redirection.  First, there is a globalassignment of the three standard file descriptors.  By default, new tasks usethis global assignment.  The global assignment of the three standardfile descriptors is controlled by the routines <b><i><a href="./ioLib.html#ioGlobalStdSet">ioGlobalStdSet</a></i>(&nbsp;)</b> and <b><i><a href="./ioLib.html#ioGlobalStdGet">ioGlobalStdGet</a></i>(&nbsp;)</b>.<p>Second, individual tasks may override the global assignment of thesefile descriptors with their own assignments that apply only to that task.  The assignment of task-specific standard file descriptors is controlled by the routines <b><i><a href="./ioLib.html#ioTaskStdSet">ioTaskStdSet</a></i>(&nbsp;)</b> and <b><i><a href="./ioLib.html#ioTaskStdGet">ioTaskStdGet</a></i>(&nbsp;)</b>.  <p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>ioLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ioLib.html#top">ioLib</a></b>, <b><a href="./iosLib.html#top">iosLib</a></b>, ansiStdio,  <i>VxWorks Programmer's Guide: I/O System</i><hr><a name="creat"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>creat</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>creat</i>(&nbsp;)</strong> - create a file</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int creat    (    const char * name, /* name of the file to create */    int          flag  /* O_RDONLY, O_WRONLY, or O_RDWR */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine creates a file called <i>name</i> and opens it with a specified<i>flag</i>.  This routine determines on which device to create the file; it then calls the create routine of the device driver to do most of the work.Therefore, much of what transpires is device/driver-dependent.<p>The parameter <i>flag</i> is set to <b>O_RDONLY</b> (0), <b>O_WRONLY</b> (1), or <b>O_RDWR</b> (2)for the duration of time the file is open.  To create NFS files with aUNIX chmod-type file mode, call <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b> with the file mode specified inthe third argument.<p></blockquote><h4>NOTE</h4><blockquote><p>For more information about situations when there are no file descriptorsavailable, see the manual entry for <b><i><a href="./iosLib.html#iosInit">iosInit</a></i>(&nbsp;)</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>A file descriptor number, or ERROR if a filename is not specified, thedevice does not exist, no file descriptors are available, or the driverreturns ERROR.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ioLib.html#top">ioLib</a></b>, <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b><hr><a name="unlink"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>unlink</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>unlink</i>(&nbsp;)</strong> - delete a file (POSIX)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS unlink    (    char * name /* name of the file to remove */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deletes a specified file.  It performs the same functionas <b><i><a href="./ioLib.html#remove">remove</a></i>(&nbsp;)</b> and is provided for POSIX compatibility.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK if there is no delete routine for the device or the driver returns OK;ERROR if there is no such device or the driver returns ERROR.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ioLib.html#top">ioLib</a></b>, <b><i><a href="./ioLib.html#remove">remove</a></i>(&nbsp;)</b><hr><a name="remove"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>remove</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>remove</i>(&nbsp;)</strong> - remove a file (ANSI)</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>STATUS remove    (    const char * name /* name of the file to remove */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine deletes a specified file.  It calls the driver for theparticular device on which the file is located to do the work.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>OK if there is no delete routine for the device or the driver returns OK;ERROR if there is no such device or the driver returns ERROR.<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ioLib.html#top">ioLib</a></b>, <i>American National Standard for Information Systems - </i><i>Programming Language - C, ANSI X3.159-1989: Input/Output (<b>stdio.h</b>), </i><hr><a name="open"></a><p align=right><a href="rtnIndex.html"><i>Libraries :  Routines</i></a></p></blockquote><h1><i>open</i>(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong><i>open</i>(&nbsp;)</strong> - open a file</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int open    (    const char * name,  /* name of the file to open */    int          flags, /* O_RDONLY, O_WRONLY, O_RDWR, or O_CREAT */    int          mode   /* mode of file to create (UNIX chmod style) */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine opens a file for reading, writing, or updating, and returnsa file descriptor for that file.  The arguments to <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b> are the filename and the type of access:<p><table><tr valign=top><td align=left><b>O_RDONLY</b>  (0)    </td><td align=left>(or READ)   </td><td align=left>- open for reading only.</tr><tr valign=top><td align=left><b>O_WRONLY</b>  (1)    </td><td align=left>(or WRITE)  </td><td align=left>- open for writing only.</tr><tr valign=top><td align=left><b>O_RDWR</b>  (2)      </td><td align=left>(or UPDATE) </td><td align=left>- open for reading and writing.</tr><tr valign=top><td align=left><b>O_CREAT</b>  (0x0200)</td><td align=left>            </td><td align=left>- create a file.</tr><tr valign=top><td align=left></tr></tr></table>In general, <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b> can only open pre-existing devices and files.  However,for NFS network devices only, files can also be created with <b><i><a href="./ioLib.html#open">open</a></i>(&nbsp;)</b> byperforming a logical OR operation with <b>O_CREAT</b> and the <i>flags</i> argument.In this case, the file is created with a UNIX chmod-style file mode, asindicated with <i>mode</i>.  For example:<pre>    fd = open ("/usr/myFile", O_CREAT | O_RDWR, 0644);</pre>Only the NFS driver uses the <i>mode</i> argument.<p></blockquote><h4>NOTE</h4><blockquote><p>For more information about situations when there are no file descriptorsavailable, see the manual entry for <b><i><a href="./iosLib.html#iosInit">iosInit</a></i>(&nbsp;)</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>A file descriptor number, or ERROR if a file name is not specified, thedevice does not exist, no file descriptors are available, or the driverreturns ERROR.<p></blockquote><h4>ERRNO</h4><blockquote><p>ELOOP<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./ioLib.html#top">ioLib</a></b>, <b><i><a href="./ioLib.html#creat">creat</a></i>(&nbsp;)</b><p>VARARGS2

⌨️ 快捷键说明

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