Boost.Nowide
stat.hpp
1 //
2 // Copyright (c) 2020 Alexander Grund
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See
5 // accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 #ifndef BOOST_NOWIDE_STAT_HPP_INCLUDED
8 #define BOOST_NOWIDE_STAT_HPP_INCLUDED
9 
10 #include <boost/nowide/config.hpp>
11 #include <sys/types.h>
12 // Include after sys/types.h
13 #include <sys/stat.h>
14 
15 #if defined(__MINGW32__) && defined(__MSVCRT_VERSION__) && __MSVCRT_VERSION__ < 0x0601
16 struct __stat64;
18 #endif
19 
20 namespace boost {
21 namespace nowide {
22 #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN)
23  // Note: `using x = struct ::stat` causes a bogus warning in GCC < 11
24  // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66159
25 
26  typedef struct ::stat stat_t;
27  typedef struct ::stat posix_stat_t;
28 
29  using ::stat;
30 #else
31  typedef struct ::__stat64 stat_t;
38  typedef struct ::_stat posix_stat_t;
39 
41  namespace detail {
42  BOOST_NOWIDE_DECL int stat(const char* path, posix_stat_t* buffer, size_t buffer_size);
43  }
45 
51  BOOST_NOWIDE_DECL int stat(const char* path, stat_t* buffer);
57  inline int stat(const char* path, posix_stat_t* buffer)
58  {
59  return detail::stat(path, buffer, sizeof(*buffer));
60  }
61 #endif
62 } // namespace nowide
63 } // namespace boost
64 
65 #endif
int stat(const char *path, stat_t *buffer)
UTF-8 aware stat function, returns 0 on success.
struct ::__stat64 stat_t
Typedef for the file info structure. Able to hold 64 bit filesize and timestamps on Windows and usual...
Definition: stat.hpp:34
struct ::_stat posix_stat_t
Typedef for the file info structure used in the POSIX stat call Resolves to struct _stat on Windows a...
Definition: stat.hpp:38