annotate docs/ccguide/read.refentry @ 2106:c4c7facbd082

Fixed up some warnings
author boisy
date Sat, 07 Oct 2006 12:11:22 +0000
parents 1d37d3a84a7c
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="read">
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>Read</refname>
574
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
4 <refname>Readln</refname>
468
60b821f18853 A little here and there.
roug
parents: 466
diff changeset
5 <refpurpose>read from a file</refpurpose>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
6 </refnamediv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
7
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
8 <refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
9 <funcsynopsis>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
10 <funcprototype>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
11 <funcdef><function>read</function></funcdef>
574
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
12 <paramdef>int <parameter>pn</parameter></paramdef>
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
13 <paramdef>char *<parameter>buffer</parameter></paramdef>
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
14 <paramdef>int <parameter>count</parameter></paramdef>
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
15 </funcprototype>
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
16 <funcprototype>
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
17 <funcdef><function>readln</function></funcdef>
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
18 <paramdef>int <parameter>pn</parameter></paramdef>
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
19 <paramdef>char *<parameter>buffer</parameter></paramdef>
c49be44efba2 All function prototypes are added.
roug
parents: 552
diff changeset
20 <paramdef>int <parameter>count</parameter></paramdef>
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
21 </funcprototype>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
22 </funcsynopsis>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
23
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
24 </refsynopsisdiv>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
25
542
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
26 <refsect1><title>Assembler Equivalent</title>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
27 <para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
28 os9 I$READ
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
29 </para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
30 <para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
31 os9 I$READLN
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
32 </para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
33 </refsect1>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
34
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
35 <refsect1><title>Description</title>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
36 <para>
604
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
37 The path number, "pn" is an integer which is one of the
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
38 standard path numbers 0, 1, or 2, or the path number should
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
39 have been returned by a successful call to "open", "creat", or
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
40 "dup". "Buffer" is a pointer to space with at least "count"
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
41 bytes of memory into which read will put the data from the
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
42 file.
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
43 </para>
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
44 <para>
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
45 It is guaranteed that at most "count" bytes will be read, but
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
46 often less will be, either because, for <function>readln</function>, the file
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
47 represents a terminal and input stops at the end of a line, or
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
48 for both, end-of-file has been reached.
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
49 </para>
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
50 <para>
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
51 Readln causes "line-editing" such as echoin to take place and
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
52 returns once the first "\n" is encountered in the input or the
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
53 number of bytes requested has been read. Readln is the
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
54 preferred call for reading from the user's terminal.
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
55 </para>
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
56 <para>
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
57 Read does not cause any such editing. See the OS-9 manual for
1d37d3a84a7c All refentries finished.
roug
parents: 574
diff changeset
58 a fuller description of the actions of these calls.
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
59 </para>
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
60 </refsect1>
542
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
61
552
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
62 <refsect1><title>Diagnostics</title>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
63 <para>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
64 Read and readln return the number of bytes actually read (0 at
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
65 end-of-file) or -1 for physical i/o errors, a bad path number,
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
66 or a ridicolous "count".
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
67 </para>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
68 <para>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
69 NOTE that end-of-file is not considered an error, and no error
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
70 indication is returned. Zero is returned on EOF.
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
71 </para>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
72 </refsect1>
fcb97f0ba24b All diagnostics added.
roug
parents: 542
diff changeset
73
542
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
74 <refsect1><title>See Also</title>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
75 <para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
76 <link linkend="open">open()</link>,
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
77 <link linkend="creat">creat()</link>,
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
78 <link linkend="dup">dup()</link>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
79 </para>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
80 </refsect1>
73319ee6a57e All "See Also" implemented
roug
parents: 468
diff changeset
81
466
bea58398bb15 Skeletons for the C Compiler User's Guide, 1983
roug
parents:
diff changeset
82 </refentry>