annotate docs/ccguide/lseek.refentry @ 2651:3f4ab32b4106

Adapted for ,U access, still more work to do
author Boisy Pitre <boisy.pitre@nuance.com>
date Mon, 02 Apr 2012 21:16:21 -0500
parents 42b2c775f05f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
1 <refentry id="lseek">
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
2 <refnamediv>
468
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
3 <refname>Lseek</refname>
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
4 <refpurpose>position in file</refpurpose>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
5 </refnamediv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
6
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
7 <refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
8 <funcsynopsis>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
9 <funcprototype>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
10 <funcdef><function>lseek</function></funcdef>
570
253b6096ee01 All function prototypes are added.
roug
parents: 552
diff changeset
11 <paramdef>int <parameter>pn</parameter></paramdef>
253b6096ee01 All function prototypes are added.
roug
parents: 552
diff changeset
12 <paramdef>long <parameter>position</parameter></paramdef>
253b6096ee01 All function prototypes are added.
roug
parents: 552
diff changeset
13 <paramdef>int <parameter>type</parameter></paramdef>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
14 </funcprototype>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
15 </funcsynopsis>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
16
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
17 </refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
18
542
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
19 <refsect1><title>Assembler Equivalent</title>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
20 <para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
21 os9 I$SEEK
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
22 </para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
23 </refsect1>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
24
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
25 <refsect1><title>Description</title>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
26 <para>
602
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
27 The read or write pointer for the open file with the path
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
28 number, "pn", is positioned by lseek to the specified place in
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
29 the file. The "type" indicates from where "position" is to be
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
30 measured: if 0, from the beginning of the file, if 1, from the
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
31 current location, or if 2, from the end of the file.
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
32 </para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
33 <para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
34 Seeking to a location beyond the end of a file open for
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
35 writing and then writing to it, creates a "hole" in the file
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
36 which appears to be filled with zeros from the previous end to
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
37 the position sought.
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
38 </para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
39 <para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
40 The returned value is the resulting position in the file unless
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
41 there is an error, so to find out the current position use
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
42 <informalexample>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
43 <para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
44 lseek(pn,0l,1);
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
45 </para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
46 </informalexample>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
47 </para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
48 </refsect1>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
49
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
50 <refsect1><title>Caveats</title>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
51 <para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
52 The argument "position" <emphasis>must</emphasis> be a long integer. Constants
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
53 should be explicitly made long by appending an "l", as above,
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
54 and other types should be converted using a cast:
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
55 <informalexample>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
56 <para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
57 e.g. lseek(pn,(long)pos,1);
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
58 </para>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
59 </informalexample>
42b2c775f05f All refentries finished.
roug
parents: 570
diff changeset
60 Notice also, that the return value from lseek is itself a long integer.
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
61 </para>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
62 </refsect1>
542
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
63
552
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
64 <refsect1><title>Diagnostics</title>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
65 <para>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
66 -1 is returned if "pn" is a bad path number, or attempting to
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
67 seek to a position before the beginning of a file.
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
68 </para>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
69 </refsect1>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
70
542
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
71 <refsect1><title>See Also</title>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
72 <para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
73 <link linkend="creat">creat()</link>,
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
74 <link linkend="open">open()</link>,
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
75 Standard Library function
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
76 <link linkend="fseek">"fseek"</link>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
77 </para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
78 </refsect1>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
79
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
80 </refentry>