Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / msvcrt-files.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="msvcrt-console.html" />
13<link rel="prev" href="module-msvcrt.html" />
14<link rel="parent" href="module-msvcrt.html" />
15<link rel="next" href="msvcrt-console.html" />
16<meta name='aesop' content='information' />
17<title>22.1.1 File Operations </title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="22.1 msvcrt - Useful"
25 href="module-msvcrt.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="22.1 msvcrt - Useful"
28 href="module-msvcrt.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="22.1.2 Console I/O"
31 href="msvcrt-console.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="module-msvcrt.html">22.1 msvcrt - Useful</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="module-msvcrt.html">22.1 msvcrt - Useful</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="msvcrt-console.html">22.1.2 Console I/O</A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H2><A NAME="SECTION0024110000000000000000"></A><A NAME="msvcrt-files"></A>
56<BR>
5722.1.1 File Operations
58</H2>
59
60<P>
61<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
62 <td><nobr><b><tt id='l2h-5240' xml:id='l2h-5240' class="function">locking</tt></b>(</nobr></td>
63 <td><var>fd, mode, nbytes</var>)</td></tr></table></dt>
64<dd>
65 Lock part of a file based on file descriptor <var>fd</var> from the C
66 runtime. Raises <tt class="exception">IOError</tt> on failure. The locked region
67 of the file extends from the current file position for <var>nbytes</var>
68 bytes, and may continue beyond the end of the file. <var>mode</var> must
69 be one of the <tt class="constant">LK_<var>*</var></tt> constants listed below.
70 Multiple regions in a file may be locked at the same time, but may
71 not overlap. Adjacent regions are not merged; they must be unlocked
72 individually.
73</dl>
74
75<P>
76<dl><dt><b><tt id='l2h-5241' xml:id='l2h-5241'>LK_LOCK</tt></b></dt>
77<dd>
78<dt><b><tt id='l2h-5247' xml:id='l2h-5247'>LK_RLCK</tt></b></dt><dd>
79 Locks the specified bytes. If the bytes cannot be locked, the
80 program immediately tries again after 1 second. If, after 10
81 attempts, the bytes cannot be locked, <tt class="exception">IOError</tt> is
82 raised.
83</dd></dl>
84
85<P>
86<dl><dt><b><tt id='l2h-5242' xml:id='l2h-5242'>LK_NBLCK</tt></b></dt>
87<dd>
88<dt><b><tt id='l2h-5248' xml:id='l2h-5248'>LK_NBRLCK</tt></b></dt><dd>
89 Locks the specified bytes. If the bytes cannot be locked,
90 <tt class="exception">IOError</tt> is raised.
91</dd></dl>
92
93<P>
94<dl><dt><b><tt id='l2h-5243' xml:id='l2h-5243'>LK_UNLCK</tt></b></dt>
95<dd>
96 Unlocks the specified bytes, which must have been previously locked.
97</dd></dl>
98
99<P>
100<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
101 <td><nobr><b><tt id='l2h-5244' xml:id='l2h-5244' class="function">setmode</tt></b>(</nobr></td>
102 <td><var>fd, flags</var>)</td></tr></table></dt>
103<dd>
104 Set the line-end translation mode for the file descriptor <var>fd</var>.
105 To set it to text mode, <var>flags</var> should be <tt class="constant">os.O_TEXT</tt>;
106 for binary, it should be <tt class="constant">os.O_BINARY</tt>.
107</dl>
108
109<P>
110<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
111 <td><nobr><b><tt id='l2h-5245' xml:id='l2h-5245' class="function">open_osfhandle</tt></b>(</nobr></td>
112 <td><var>handle, flags</var>)</td></tr></table></dt>
113<dd>
114 Create a C runtime file descriptor from the file handle
115 <var>handle</var>. The <var>flags</var> parameter should be a bit-wise OR of
116 <tt class="constant">os.O_APPEND</tt>, <tt class="constant">os.O_RDONLY</tt>, and
117 <tt class="constant">os.O_TEXT</tt>. The returned file descriptor may be used as a
118 parameter to <tt class="function">os.fdopen()</tt> to create a file object.
119</dl>
120
121<P>
122<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
123 <td><nobr><b><tt id='l2h-5246' xml:id='l2h-5246' class="function">get_osfhandle</tt></b>(</nobr></td>
124 <td><var>fd</var>)</td></tr></table></dt>
125<dd>
126 Return the file handle for the file descriptor <var>fd</var>. Raises
127 <tt class="exception">IOError</tt> if <var>fd</var> is not recognized.
128</dl>
129
130<P>
131
132<DIV CLASS="navigation">
133<div class='online-navigation'>
134<p></p><hr />
135<table align="center" width="100%" cellpadding="0" cellspacing="2">
136<tr>
137<td class='online-navigation'><a rel="prev" title="22.1 msvcrt - Useful"
138 href="module-msvcrt.html"><img src='../icons/previous.png'
139 border='0' height='32' alt='Previous Page' width='32' /></A></td>
140<td class='online-navigation'><a rel="parent" title="22.1 msvcrt - Useful"
141 href="module-msvcrt.html"><img src='../icons/up.png'
142 border='0' height='32' alt='Up One Level' width='32' /></A></td>
143<td class='online-navigation'><a rel="next" title="22.1.2 Console I/O"
144 href="msvcrt-console.html"><img src='../icons/next.png'
145 border='0' height='32' alt='Next Page' width='32' /></A></td>
146<td align="center" width="100%">Python Library Reference</td>
147<td class='online-navigation'><a rel="contents" title="Table of Contents"
148 href="contents.html"><img src='../icons/contents.png'
149 border='0' height='32' alt='Contents' width='32' /></A></td>
150<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
151 border='0' height='32' alt='Module Index' width='32' /></a></td>
152<td class='online-navigation'><a rel="index" title="Index"
153 href="genindex.html"><img src='../icons/index.png'
154 border='0' height='32' alt='Index' width='32' /></A></td>
155</tr></table>
156<div class='online-navigation'>
157<b class="navlabel">Previous:</b>
158<a class="sectref" rel="prev" href="module-msvcrt.html">22.1 msvcrt - Useful</A>
159<b class="navlabel">Up:</b>
160<a class="sectref" rel="parent" href="module-msvcrt.html">22.1 msvcrt - Useful</A>
161<b class="navlabel">Next:</b>
162<a class="sectref" rel="next" href="msvcrt-console.html">22.1.2 Console I/O</A>
163</div>
164</div>
165<hr />
166<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
167</DIV>
168<!--End of Navigation Panel-->
169<ADDRESS>
170See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
171</ADDRESS>
172</BODY>
173</HTML>