in reply to How to stat a file with a Unicode (UTF16-LE) filename in Windows?
Of course, calling stat (a unix system call emulation) is a very roundabout way of calling GetFileTime. The work has already been done for you in Win32API::File::Time.
use strict; use warnings; use Encode qw( encode ); use Win32API::File::Time qw( GetFileTime ); { # The file name consists of a black heart (U+2665). my $fn = encode('UCS-2le', "\x{2665}"); local ${^WIDE_SYSTEM_CALLS} = 1; my ($atime, $mtime, $ctime) = GetFileTime($fn) or die("GetFileTime: $^E\n"); print("atime: ", scalar(localtime($atime)), "\n"); print("mtime: ", scalar(localtime($mtime)), "\n"); print("ctime: ", scalar(localtime($ctime)), "\n"); }
atime: Fri Feb 6 00:44:39 2009 mtime: Fri Feb 6 00:44:39 2009 ctime: Fri Feb 6 00:44:39 2009
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to stat a file with a Unicode (UTF16-LE) filename in Windows?
by alanhaggai (Novice) on Feb 06, 2009 at 06:27 UTC | |
by ikegami (Patriarch) on Feb 06, 2009 at 06:32 UTC | |
by alanhaggai (Novice) on Feb 06, 2009 at 06:38 UTC | |
by cdarke (Prior) on Feb 06, 2009 at 11:02 UTC | |
by Anonymous Monk on Mar 07, 2013 at 09:36 UTC |