Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #138999

Re: file system lib for C

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: file system lib for C
Date 2018-12-23 13:39 -0800
Organization None to speak of
Message-ID <lnbm5bdith.fsf@kst-u.example.com> (permalink)
References <2156f362-0d1f-4e41-bbd9-bcc27344fe56@googlegroups.com> <g8a9vsFplqbU1@mid.individual.net>

Show all headers | View raw


rbowman <bowman@montana.com> writes:
> On 12/23/2018 11:12 AM, Thiago Adams wrote:
>> bool create_directory( const std::filesystem::path& p, std::error_code& ec ) noexcept;
>>
>> I don't think error_code deserves a exactly copy
>> https://en.cppreference.com/w/cpp/error/error_code
>> because it is too complicated.
>>
>> Suggestions how to adapt this for C and contributions/critics
>> are welcome.
>>
>
> I'm not sure I understand your question but
>
> #include <errno.h>
> #include <string.h>
> ................
> if (mkdir(path, mode) == -1) {
>     fprintf(stderr, "mkdir failed: %s\n", strerror(errno));
>     /* do whatever error recovery you need */
> }

mkdir() requires `#include <sys/stat.h>`, which is POSIX-specific and
not part of the C standard.  C++'s std::filesystem (new in C++17) is, I
think, intended to be more general.

[...]

-- 
Keith Thompson (The_Other_Keith) kst@mib.org  <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

file system lib for C Thiago Adams <thiago.adams@gmail.com> - 2018-12-23 10:12 -0800
  Re: file system lib for C Clark Smith <noaddress@nowhere.net> - 2018-12-23 20:20 +0000
    Re: file system lib for C James Kuyper <jameskuyper@alumni.caltech.edu> - 2018-12-23 16:41 -0500
    Re: file system lib for C Thiago Adams <thiago.adams@gmail.com> - 2018-12-30 10:33 -0800
      Re: file system lib for C nobody@example.org (Scott) - 2018-12-30 20:42 +0000
        Re: file system lib for C Thiago Adams <thiago.adams@gmail.com> - 2018-12-30 12:52 -0800
  Re: file system lib for C rbowman <bowman@montana.com> - 2018-12-23 13:38 -0700
    Re: file system lib for C Keith Thompson <kst-u@mib.org> - 2018-12-23 13:39 -0800
      Re: file system lib for C Thiago Adams <thiago.adams@gmail.com> - 2018-12-30 11:09 -0800
        Re: file system lib for C "Chris M. Thomasson" <invalid_chris_thomasson@invalid.invalid> - 2018-12-30 14:59 -0800
        Re: file system lib for C rbowman <bowman@montana.com> - 2018-12-30 16:09 -0700
  Re: file system lib for C nobody@example.org (Scott) - 2018-12-23 20:51 +0000
  Re: file system lib for C jgh@mdfs.net - 2018-12-30 09:15 -0800
    Re: file system lib for C Thiago Adams <thiago.adams@gmail.com> - 2018-12-30 10:34 -0800

csiph-web