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