in reply to Re^2: Problems Opening file with Perl where path has UTF8 (d'oh!)
in thread Problems Opening file with Perl where path has UTF8

Update: The striken text is only true for the system call CreateFileW, but not for Win32API::File's verion of CreateFileW.

CreateFileW returns INVALID_FILE_HANDLE (-1) on error, not false.

use constant INVALID_FILE_HANDLE => -1; my $hFile= CreateFileW( $wPath, GENERIC_READ()|GENERIC_WRITE(), FILE_SHARE_READ()|FILE_SHARE_WRITE(), [], OPEN_EXISTING(), 0, [] ); INVALID_FILE_HANDLE != $hFile or die "Can't open: $^E\n";

Replies are listed 'Best First'.
Re^4: Problems Opening file with Perl where path has UTF8 (error)
by tye (Sage) on Nov 25, 2006 at 08:18 UTC

    Did you try this? Because the XS code and the documentation for Win32API::File's CreateFile() shows that a false value is returned on error.

    - tye        

      My apologies. My testing had been done with the Kernel32's CreateFileW, not with Win32API::File::CreateFileW.