0

OK, maybe not, but which ones do you need in order read, write and delete files and directories? I've got stdio.h and stat.h and now I find I need unistd.h in order to use unlink. I've never heard of unistd.h. Maybe I should be using something else besides unlink? Right now I'm using C on Linux Mint.

Chuck Pergiel
  • 151
  • 2
  • 14
  • 2
    `stdio.h` provides `remove()` for deleting a file – M.M Jun 13 '16 at 23:17
  • 1
    You can use `remove()` instead of `unlink()`; it's in ``. It will remove empty directories. `` is the primary POSIX header. It has `mkdir()` and `rmdir()`. There are a myriad others you might need, depending on what you're up to (``, ``, ``, …). See [List of standard header files in C and C++](https://stackoverflow.com/questions/2027991/) for a list of possible headers. (Note that the standard header for `stat()` is ``, not ``. And, somewhat tangentially, `` and `` define separate sets of facilities.) – Jonathan Leffler Jun 13 '16 at 23:18
  • Thanks guys, er, peoples. The program reads directories, so I used POSIX calls. Seemed like a good idea at the time. Could have sworn that I ran it on Linux, but it's beginning to look like that never happened. – Chuck Pergiel Jun 15 '16 at 19:38

0 Answers0