Problem with stat

Erich Dollansky oceanare@pacific.net.sg
Tue Jun 26 12:57:00 GMT 2007


Hi,

Eric Blake wrote:
> 
> If it were truly C++, you would have also showed the include files and
> preprocessor macros that you used.  If you want help on this issue,
> provide a COMPILABLE example, and preferably one that is not so masked by
> macros that it looks more like pascal than C++.
> 
here we are.

The problem has nothing to do with the program.

#include <stdio.h>
#include <sys/stat.h>
int main (int argc, char ** argv)
{
    int res;
    struct   stat     Stat;

    res = 0;
    if (stat ("/usr/X11R6/share/doc/lesstif-0.94.4/html/Lessdox", &Stat) 
== 0)
    {
       printf ("Mode: %lX\n", (unsigned long) Stat.st_mode);
       if (S_ISDIR (Stat.st_mode))
          printf ("Directory flag is set.\n");
       if (S_ISREG (Stat.st_mode))
          printf ("Is a regular file.\n");
       if (S_ISLNK (Stat.st_mode))
          printf ("Link flag is set.\n");
    }
}

plus the make file

CFLAGS	+= -I .			\
		-funsigned-char		\
		-Wall

Inter	= Inter/
Run	= Run/
obj	= .obj
exe	= .exe
make	= .make

All:	test${make}		\
		teststat.cpp	\
		${Inter}teststat${obj}			\
		${Run}teststat${exe}

${Inter}teststat${obj}:	teststat.cpp
	g++ ${CFLAGS} -c teststat.cpp -o ${Inter}teststat${obj}

${Run}teststat${exe}:	${Inter}teststat${obj}
	g++ ${CFLAGS}			\
		${Inter}teststat${obj}	\
		-o ${Run}teststat${exe}

The result is the same as before.

Erich

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list