• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html lang="en">
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5<meta http-equiv="Content-Style-Type" content="text/css">
6<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
7<title>FatFs - f_truncate</title>
8</head>
9
10<body>
11
12<div class="para func">
13<h2>f_truncate</h2>
14<p>The f_truncate function truncates the file size.</p>
15<pre>
16FRESULT f_truncate (
17  FIL* <span class="arg">fp</span>     <span class="c">/* [IN] File object */</span>
18);
19</pre>
20</div>
21
22<div class="para arg">
23<h4>Parameter</h4>
24<dl class="par">
25<dt>fp</dt>
26<dd>Pointer to the open file object to be truncated. If a null pointer is given, the function fails with <tt>FR_INVALID_OBJECT</tt>.</dd>
27</dl>
28</div>
29
30
31<div class="para ret">
32<h4>Return Values</h4>
33<p>
34<a href="rc.html#ok">FR_OK</a>,
35<a href="rc.html#de">FR_DISK_ERR</a>,
36<a href="rc.html#ie">FR_INT_ERR</a>,
37<a href="rc.html#dn">FR_DENIED</a>,
38<a href="rc.html#io">FR_INVALID_OBJECT</a>,
39<a href="rc.html#tm">FR_TIMEOUT</a>
40</p>
41</div>
42
43
44<div class="para desc">
45<h4>Description</h4>
46<p>The <tt>f_truncate</tt> function truncates the file size to the current file read/write pointer. This function has no effect if the file read/write pointer is already pointing end of the file.</p>
47</div>
48
49
50<div class="para comp">
51<h4>QuickInfo</h4>
52<p>Available when <tt><a href="config.html#fs_readonly">FF_FS_READONLY</a> == 0</tt> and <tt><a href="config.html#fs_minimize">FF_FS_MINIMIZE</a> == 0</tt>.</p>
53</div>
54
55
56<div class="para ref">
57<h4>See Also</h4>
58<p><tt><a href="open.html">f_open</a>, <a href="lseek.html">f_lseek</a>, <a href="sfile.html">FIL</a></tt></p>
59</div>
60
61
62<p class="foot"><a href="../00index_e.html">Return</a></p>
63</body>
64</html>
65