delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/06/26/08:57:18

X-Spam-Check-By: sourceware.org
Message-ID: <46810D24.9000303@pacific.net.sg>
Date: Tue, 26 Jun 2007 16:57:08 +0400
From: Erich Dollansky <oceanare AT pacific DOT net DOT sg>
User-Agent: Thunderbird 2.0.0.4 (Windows/20070604)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Problem with stat
References: <46808EA8 DOT 2030202 AT pacific DOT net DOT sg> <4680DD73 DOT 8090300 AT sh DOT cvut DOT cz> <4680E3A0 DOT 3020508 AT pacific DOT net DOT sg> <4680FE40 DOT 7010102 AT byu DOT net>
In-Reply-To: <4680FE40.7010102@byu.net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019