"Fossies" - the Fresh Open Source Software Archive

Member "cloc-1.86/tests/inputs/issues/420/mixed_case_ext.Pl" (19 May 2020, 574 Bytes) of package /linux/privat/cloc-1.86.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 # https://stackoverflow.com/questions/1721807/how-do-i-create-then-use-long-windows-paths-from-perl#1722223
    2 use Win32::API;
    3 $cd = Win32::API->new('kernel32', 'CreateDirectoryW', 'PP', 'N');
    4 $dir = '\\\\?\\c:\\Users\\IEUser\\!long_dir';
    5 
    6 $res = 1;
    7 
    8 my $i = 1;
    9 do {
   10     print 'path length: ' . length($dir) . "\n";
   11     $dirname = pack('S*', unpack('C*', "$dir\0"));  #dirty way to produce UTF-16LE string
   12 
   13     $res = $cd->Call($dirname, 0);
   14     print "$res\n";
   15 
   16     $dir .= '\\' . sprintf "D%09d", $i;
   17     ++$i;
   18     $res = 0 if $i > 30;
   19 
   20 } while ( $res );