S_ISREG macro undefined

Questions <ul>

Are posix macros only S_ISREG, S_ISDIR, etc. Linux? I need to find out because I'm trying to compile CURL and trying to use them in windows. What the file includes. I use them to access windows.

This is a violation code.

/*we ignore file size for char/block devices, sockets etc*/
if(S_ISREG(fileinfo.st_mode))
   uploadfilesize= fileinfo.st_size;
}

and causes an error

error LNK2019: unresolved external symbol _S_ISREG referenced in function _operate file tool_operate.obj

The following questions refer to them.

Apparently, S_ISREG () is part of a lot of posix macros and apparently should tell us if the file is a “regular file”, but all the examples I found contain files related to linux.

+5
source share
4 answers

Windows , FindFirstFile, FindNextFile win32 api, , .

gcc/mingw, stat(). sys/stat.h .

+2

, :

#include <sys/stat.h>

#if defined(WIN32) || defined(WIN64)
    // Copied from linux libc sys/stat.h:
    #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
    #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif
+8

curl 7.21.5 setup.h :

#if !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#endif
+3

(_S_ISREG). MinGW lib S_ISREG <sys/stat.h>

, .

+1

All Articles