File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 333
333
\item The example above is complete. You can cut-and-paste, compile, and run
334
334
it. Obviously, due to the slide size constraint, it is missing several error
335
335
checks otherwise needed for a well behaved utility, like checking \texttt {argc }
336
- before using \texttt {argv }, or checking return values for \texttt {open } and
337
- \texttt {creat }.
336
+ before using \texttt {argv }, or checking return values for \texttt {open },
337
+ \texttt {creat }, \texttt {read }, and \texttt {write }, and reporting possible
338
+ errors.
338
339
\item It is not efficient to read and write by a few bytes as each system call
339
340
costs a certain overhead, independent on the size of the processed block. It is
340
341
much better to read and write larger blocks, say 8-1024KB. You can
347
348
overhead.
348
349
\item If you need to work with little pieces of data read from files, you can
349
350
use stream oriented functions that internally buffer the data -- \texttt {fopen },
350
- \texttt {fread }, \dots
351
+ \texttt {fread }, \dots However, please do not use those functions in your
352
+ semester assignment and at the exam.
351
353
\item Note that we always only write as many bytes as we actually read. See
352
354
page \pageref {READCALL } for more information on when we can read/write less data
353
355
than requested.
You can’t perform that action at this time.
0 commit comments