summaryrefslogtreecommitdiff
path: root/reference/C/MISC/io.html
diff options
context:
space:
mode:
Diffstat (limited to 'reference/C/MISC/io.html')
-rw-r--r--reference/C/MISC/io.html89
1 files changed, 89 insertions, 0 deletions
diff --git a/reference/C/MISC/io.html b/reference/C/MISC/io.html
new file mode 100644
index 0000000..356986c
--- /dev/null
+++ b/reference/C/MISC/io.html
@@ -0,0 +1,89 @@
+<title>Input and Output</title>
+<body bgcolor="#ffffcc">
+<hr>
+<center>
+<h1>Input and Output</h1>
+</center>
+<hr>
+<p>
+The C language does not have any I/O capability! You can access
+files and devices via two groups of functions, these can be split
+as shown below.<p>
+
+<ul>
+<li><a href=#low>Low level.</a>
+<li><a href=#ansi>ANSI.</a>
+</ul>
+<a name=low>
+<h2>Low Level I/O</h2>
+
+Low level functions provide direct access to files and devices. If you
+only need file read and write you should use the
+<a href=#ansi>ANSI</a> functions as your code will remain portable.
+If you want to access things like, serial ports, virtual memory and
+tape drives, low level I/O is for you.<p>
+
+Low level functions reference files by a
+<a href=../glossary.html#filedes>file descriptor</a>, this descriptor
+is created with the <a href=../FUNCTIONS/open.html>open</a> function and
+can be referenced by functions like:<p>
+<a href=../FUNCTIONS/close.html>close</a><br>
+<a href=../FUNCTIONS/read.html>read</a><br>
+<a href=../FUNCTIONS/write.html>write</a><br>
+mmap - Memory map (Not supported on Linux).<br>
+<a href=../MAN/ioctl.htm>ioctl</a> I/O control.<p>
+
+Three 'file descripters' are opened automatically when your program runs.
+These are:
+<pre>
+ File Default
+ Desc Name device
+ ---- ---- ------
+ 0 <a href=stdfiles.html>stdin</a> Keyboard
+ 1 <a href=stdfiles.html>stdout</a> Screen
+ 2 <a href=stdfiles.html>stderr</a> Screen
+</pre>
+
+If you want to use these 'file descriptors', you do not have to issue an
+'open'.
+
+
+<a name=ansi>
+<h2>ANSI standard functions</h2>
+
+These functions are defined in the
+<a href=../FUNCTIONS/funcref.htm#stdio>stdio.h</a> header.
+
+The important thing to remember with these functions is the data
+is presented in a consistant manor across all platforms. A record
+is considered to be 0 or more characters followed by a
+<a href=../FUNCTIONS/escape.html>newline</a> character.
+If the actual (physical) record is terminated in some other way, the
+functions will perform the conversion for you.
+<hr>
+<p>
+<center>
+<table border=2 width=80% bgcolor=ivory>
+<tr align=center>
+<td width=25%>
+<a href="../cref.html" target="_top">Top</a>
+</td><td width=25%>
+<a href="../master_index.html" target="_top">Master Index</a>
+</td><td width=25%>
+<a href="../SYNTAX/keywords.html" target="_top">C Keywords</a>
+</td><td width=25%>
+<a href="../FUNCTIONS/funcref.htm" target="_top">Functions</a>
+</td>
+</tr>
+</table>
+</center>
+<p>
+<hr>
+<address>Martin Leslie
+<script language="JavaScript">
+<!-- //
+document.write(document.lastModified);
+// -->
+</script>
+</address>
+