File input/output: Difference between revisions
Content added Content deleted
(→[[C]]: rm <highlightSyntax> tags) |
(→[[C]]: rm note about not closing files - this has been fixed, rephrased, added note about using POSIX calls not included in ANSI C) |
||
Line 112: | Line 112: | ||
don't need. |
don't need. |
||
The following example addresses those issues. To avoid buffered IO, it uses ''open()'', ''read()'', ''write()'' and ''close()'', which are part of [[POSIX]], but not defined of [[ANSI C]]. |
|||
It doesn't close the files afer it's done, relying on them being |
|||
closed and their output flushed when the program exits. Not a problem |
|||
in this particular case, but a bad habit to get into. |
|||
An example that addresses these: |
|||
#include <stdio.h> |
#include <stdio.h> |
||
#include <unistd.h> |
#include <unistd.h> |