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 333333\item The example above is complete. You can cut-and-paste, compile, and run
334334it. Obviously, due to the slide size constraint, it is missing several error
335335checks 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.
338339\item It is not efficient to read and write by a few bytes as each system call
339340costs a certain overhead, independent on the size of the processed block. It is
340341much better to read and write larger blocks, say 8-1024KB. You can
347348overhead.
348349\item If you need to work with little pieces of data read from files, you can
349350use 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.
351353\item Note that we always only write as many bytes as we actually read. See
352354page \pageref {READCALL } for more information on when we can read/write less data
353355than requested.
You can’t perform that action at this time.
0 commit comments