Mail Archives: cygwin/2001/02/15/18:26:27
> Date: Thu, 15 Feb 2001 16:09:46 -0500
> From: "Larry Hall (RFK Partners, Inc)" <lhall AT rfk DOT com>
>
> >Example code:
> >
> > struct stat st;
> > stat_select("foo", &st, ST_MODE | ST_MTIME);
> >
> >Cygwin.DLL:
> > int stat(const char* file, struct stat* pst)
> > {
> > return stat_select(file, pst, 0xFFFFFFFF);
> > }
>
>
> Sure, this is an idea for new, Cygwin specific code. I'm not quite
> sure why someone who was writing new code (or changing old) wouldn't just
> use Win32 APIs to accomplish the required task though.
Because all you would have to do to modify your code to work with
Cygwin is to use stat_select with the correct bitmask. You wouldn't
have to convert any of the information returned by the Win32 APIs into
the format the rest of your code expects, and in fact you could just
keep using the same "struct stat" as you were using before.
In other words, something like this is a lot simpler than writing a
lot of Win32 API calls in your code:
struct stat st;
#ifdef __CYGWIN__
stat_select("foo", &st, <whatever>);
#else
stat("foo", &st);
#endif
jik
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -