|
484 | 484 | the file size will be set accordingly, the ``holes'' will be read as zeros. |
485 | 485 | Note that just changing the file position will not increase the file size. |
486 | 486 | \item You can get the file size via \texttt{lseek(fildes, 0, SEEK\_END)}. |
487 | | -\item The most common operations with \texttt{lseek} are three: seeting the |
| 487 | +\item The most common operations with \texttt{lseek} are three: setting the |
488 | 488 | position from the beginning of a file, setting the position to the end of a |
489 | 489 | file, and getting the current file position (0 with \texttt{SEEK\_CUR}). |
490 | 490 | \item There is no I/O involved when calling \texttt{lseek}. |
|
500 | 500 | \item Beware of confusing the parameters. The second line below looks OK but |
501 | 501 | the arguments are in reversed order. What is more, \texttt{SEEK\_SET} is |
502 | 502 | defined as 0 and \texttt{SEEK\_CUR} is 1, so the file position is not moved |
503 | | -which is not by itself a disasterous thing, and makes it more difficult to find |
| 503 | +which is not by itself a disastrous thing, and makes it more difficult to find |
504 | 504 | it: |
505 | 505 |
|
506 | 506 | \begin{verbatim} |
|
956 | 956 | \texttt{d\_type}. It can have values of \texttt{DT\_REG}, \texttt{DT\_DIR}, |
957 | 957 | \texttt{DT\_FIFO} etc., see the man page for \texttt{dirent}. It was a BSD |
958 | 958 | specific thing and subsequently copied by other systems, including Linux. |
959 | | -However, it is not part of SUSv4 and thus not portable, unfortunatelly. The |
960 | | -portable way is to call \texttt{stat} on each directory entry. |
| 959 | +However, it is not part of SUSv4 and thus not portable, unfortunately. |
| 960 | +The portable way is to call \texttt{stat} on each directory entry. |
961 | 961 | \item \texttt{rmdir} does not work on directories that are not empty. You have |
962 | 962 | to remove all entries before you can delete a directory. You you use |
963 | 963 | \texttt{system("rm -r xxx")} etc. but be careful to sanitize the environment and |
|
0 commit comments