comparison docs/ccguide/lseek.refentry @ 602:42b2c775f05f

All refentries finished.
author roug
date Fri, 15 Nov 2002 21:49:51 +0000
parents 253b6096ee01
children
comparison
equal deleted inserted replaced
601:8b8736b66631 602:42b2c775f05f
22 </para> 22 </para>
23 </refsect1> 23 </refsect1>
24 24
25 <refsect1><title>Description</title> 25 <refsect1><title>Description</title>
26 <para> 26 <para>
27 Placeholder 27 The read or write pointer for the open file with the path
28 number, "pn", is positioned by lseek to the specified place in
29 the file. The "type" indicates from where "position" is to be
30 measured: if 0, from the beginning of the file, if 1, from the
31 current location, or if 2, from the end of the file.
32 </para>
33 <para>
34 Seeking to a location beyond the end of a file open for
35 writing and then writing to it, creates a "hole" in the file
36 which appears to be filled with zeros from the previous end to
37 the position sought.
38 </para>
39 <para>
40 The returned value is the resulting position in the file unless
41 there is an error, so to find out the current position use
42 <informalexample>
43 <para>
44 lseek(pn,0l,1);
45 </para>
46 </informalexample>
47 </para>
48 </refsect1>
49
50 <refsect1><title>Caveats</title>
51 <para>
52 The argument "position" <emphasis>must</emphasis> be a long integer. Constants
53 should be explicitly made long by appending an "l", as above,
54 and other types should be converted using a cast:
55 <informalexample>
56 <para>
57 e.g. lseek(pn,(long)pos,1);
58 </para>
59 </informalexample>
60 Notice also, that the return value from lseek is itself a long integer.
28 </para> 61 </para>
29 </refsect1> 62 </refsect1>
30 63
31 <refsect1><title>Diagnostics</title> 64 <refsect1><title>Diagnostics</title>
32 <para> 65 <para>