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

135 lines
4.9 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!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>ftruncate64()--Truncate File (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. -->
<!-- file cleaned -->
<!-- Unix2 SCRIPT J converted by B2H R4.1 (346) (CMS) by V2KEA304 -->
<!-- at RCHVMW2 on 17 Feb 1999 at 11:05:09 -->
<!-- Change History: -->
<!-- 011022 JTROUS Changes from API Review 1, V5R2 -->
<!-- 020514 JET This file has undergone html cleanup -->
<!-- 030217 JTROUS : Add words about offset not updated -->
<!-- 050415 JTROUS Changes from API Review 1, V5R4, no change flag -->
<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>ftruncate64()--Truncate File (Large File Enabled)</h2>
<div class="box" style="width: 70%;">
<br>
&nbsp;&nbsp;Syntax<br>
<pre>
#include &lt;unistd.h&gt;
int ftruncate64(int <em>file_descriptor</em>, off64_t <em>length</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>ftruncate64()</strong> function truncates the file indicated by
the open file descriptor <em>file_descriptor</em> to the indicated <em>
length</em>. <em>file_descriptor</em> must be a "regular file" that is open for
writing. (A regular file is a stream file that can support positioning the file
offset.) If the file size exceeds <em>length</em>, any extra data is discarded.
If the file size is smaller than <em>length</em>, the file is extended and
filled with binary zeros to the indicated length. (In the QSYS.LIB and
independent ASP QSYS.LIB file systems, blanks are used instead of zeros to pad
records after a member is extended.)
The <strong>ftruncate64()</strong> function does not modify the current file offset
for any open file descriptions associated with the file.
</p>
<p><strong>ftruncate64()</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 in the oflag
parameter.</li>
</ul>
<p>If <strong>ftruncate64()</strong> completes successfully, it marks the
change time and modification times of the file. If <strong>
ftruncate64()</strong> is not successful, the file is unchanged.</p>
<p>For additional information about parameters, authorities, error conditions,
and examples, see <a href="ftruncat.htm">ftruncate()--Truncate File</a>.</p>
<br>
<h3><a name="usage_notes">Usage Notes</a></h3>
<ol type="1">
<li>For file systems that do support large files, this function will fail with
the [EFBIG] error if the <em>length</em> specified is greater than 2GB minus 1
byte and O_LARGEFILE is not set in the oflag.<br><br>
</li>
<li>For file systems that do not support large files, this function will fail
with the [EINVAL] error if the <em>length</em> specified is greater than 2GB
minus 1 byte.<br><br>
</li>
<li>QFileSvr.400 File System Differences
<p>Although QFileSvr.400 does not support large files, it will return [EFBIG]
if the <em>length</em> specified is greater than 2GB minus 1 byte.</p>
</li>
<li>When you develop in C-based languages, the prototypes for the 64-bit APIs
are normally hidden. To use the <strong>ftruncate64()</strong> API and the
off64_t data type, you must compile the source with _LARGE_FILE_API
defined.<br><br>
</li>
<li>All of the usage notes for <strong>ftruncate()</strong> apply to <strong>
ftruncate64()</strong>. See <a href="ftruncat.htm#HDRFTRNUSG">Usage Notes</a>
in the <strong>ftruncate()</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>