ibm-information-center/dist/eclipse/plugins/i5OS.ic.apis_5.4.0.1/lseek64.htm

117 lines
4.5 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Copyright" content="Copyright (c) 2006 by IBM Corporation">
<title>lseek64()--Set File Read/Write Offset (Large File Enabled)</title>
<!-- Begin Header Records ========================================== -->
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<!-- Change History: -->
<!-- YYMMDD USERID Change description -->
<!-- file cleaned -->
<!-- Unix2 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- 011022 JTROUS Changes from API Review 1, V5R2 -->
<!-- This file has undergone html cleanup May 2002 by JET -->
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</head>
<body>
<!--End Header Records --><!-- Java sync-link -->
<script language="Javascript" src="../rzahg/synch.js" type="text/javascript">
</script>
<a name="Top_Of_Page"></a>
<h2>lseek64()--Set File Read/Write Offset (Large File Enabled)</h2>
<div class="box" style="width: 70%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;unistd.h&gt;
off64_t lseek64(int <em>file_descriptor</em>,
off64_t <em>offset</em>, int <em>whence)</em>;
</pre>
&nbsp;&nbsp;Service Program Name: QP0LLIB1<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Default Public Authority: *USE<br>
<!-- iddvc RMBR -->
<br>
&nbsp;&nbsp;Threadsafe: Conditional; see <a href="#USAGE_NOTES">Usage Notes</a>.<br>
<!-- iddvc RMBR -->
<br>
</div>
<p>The <strong>lseek64()</strong> function changes the current file offset to a
new position in the file. The new position is the given byte <em>offset</em>
from the position specified by <em>whence</em>. After you have used <strong>
lseek64()</strong> to seek to a new location, the next I/O operation on the
file begins at that location.</p>
<p><strong>lseek64()</strong> lets you specify new file offsets past the
current end of the file. If data is written at such a point, read operations in
the gap between this data and the old end of the file will return bytes
containing binary zeros (or bytes containing blanks in the QSYS.LIB or
independent ASP QSYS.LIB file systems). In other words, the gap is assumed to
be filled with zeros (or with blanks in the QSYS.LIB or independent ASP
QSYS.LIB file systems). If you seek past the end of a file, however, the length
of the file is not automatically extended. The maximum offset that can be
specified is the largest value that can be held in an 8-byte, signed integer.
You must do a write operation before the file is actually extended.</p>
<p>In the QSYS.LIB or independent ASP QSYS.LIB file systems, you can seek only
to the beginning of a member while in text mode.</p>
<p><strong>lseek64()</strong> is enabled for large files. It is capable of
operating on files larger than 2GB minus 1 byte as long as the file has been
opened by either of the following:</p>
<ul compact>
<li>Using the <strong>open64()</strong> function (see <a href="open64.htm">
open64()--Open File (Large File Enabled)</a>).</li>
<li>Using the <strong>open()</strong> function (see <a href="open.htm">
open()--Open File</a>) with the O_LARGEFILE flag set.</li>
</ul>
<p>For additional information about parameters, authorities required, error
conditions and examples, see <a href="lseek.htm">lseek()--Set File Read/Write
Offset</a>.</p>
<br>
<h3><a name="usage_notes">Usage Notes</a></h3>
<ol type="1">
<li>When you develop in C-based languages, the prototypes for the 64-bit APIs
are normally hidden. To use the <strong>lseek64()</strong> API and the off64_t
data type, you must compile the source with the _LARGE_FILE_API defined.<br>
</li>
<li>All of the usage notes for <strong>lseek()</strong> apply to <strong>
lseek64()</strong>. See <a href="lseek.htm#HDRLSKUSAG">Usage Notes</a> in the
<strong>lseek()</strong> API.</li>
</ol>
<br>
<hr>
API introduced: V4R4
<hr>
<center>
<table cellpadding="2" cellspacing="2">
<tr align="center">
<td valign="middle" align="center"><a href="#Top_Of_Page">Top</a> | <a href=
"unix.htm">UNIX-Type APIs</a> | <a href="aplist.htm">APIs by category</a></td>
</tr>
</table>
</center>
</body>
</html>