bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnulib] RE: GNULib save-cwd.c on Windows & Visual Studio 6.0


From: Conrad T. Pino
Subject: [bug-gnulib] RE: GNULib save-cwd.c on Windows & Visual Studio 6.0
Date: Wed, 9 Mar 2005 06:22:56 -0800

 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Jim,

> From: Jim Meyering [mailto:address@hidden
> 
> This is not about Microsoft per se, but simply about
> the lack of fchdir (or POSIX support in general) in WOE.

I agree let's not enumerate Microsoft's flaws as we would never
finish. :)

> I suppose it's a long shot, but...
> is there a way, in WOE/MSVC, to emulate fchdir's behavior?

I think not.  My research on http://msdn.microsoft.com site came
up with no hint of a method to translate an open file / directory
handle into a path name.

> I.e., given a file descriptor that is the result of opening a
> directory, can you obtain an absolute path name of that directory?

Worse, if "C:\work" is a directory attempts to use the Visual C 6.0
"open" function with "_O_RDONLY" argument to open "." or "C:\work"
will both return -1 value i.e. error.  Sample program follows.

Conrad

#include <stdio.h>
#include <io.h>
#include <fcntl.h>

static int opendir( char *name )
{
        int fd;

        fd = open( name,  _O_RDONLY );
        printf( "open %s = %d\n", name, fd );

        close( fd );

        return fd;
}

int main(int argc, char* argv[])
{
        int fd;

        printf("Hello World!\n");

        fd = opendir( "test.txt" );
        fd = opendir( "." );
        fd = opendir( "C:\\work" );

        return 0;
}

-----BEGIN PGP SIGNATURE-----
Version: PGP 7.0.4

iQA/AwUBQi8GwLNM28ubzTo9EQJxHwCg4H3VBV4ftjY6Jau9DuleH/0mvykAoLee
EKxRsykxCHYpu0r1VRvKe6aq
=RI6I
-----END PGP SIGNATURE-----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]