On 20/03/2003 12:12:27 JamesTillman wrote:

>> -----Original Message-----
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Thursday, March 20, 2003 4:34 AM
>> Cc: [EMAIL PROTECTED]
>> Subject: RE: (no subject)
>>
>>
>>
>> >Try \\\\server\\new\$
>> >
>>
>> Don't. Try '\\server\new$' if you need to give it to cmd.exe
>> ALWAYS use forward slashes with Perl.
>
>Did you test this?  It doesn't work for me.  From this:
>
>my $var = '\\webdev\d$';
>print $var . "\n";
>system("dir $var");
>
>I get:
>
>\webdev\d$
>dir: \\webdev\\d$: No such file or directory
>

Nope. Serves me right :-(

[snip]
>
>I have found this feature to be inconsistently applied throughout
>Microsoft's systems (and the problem exists in places other than just
>cmd.exe),  which makes it not really worth using, doesn't it?  If you
can't
>rely on it being applied everywhere, you might as well get used to
counting
>toothpicks:  \\\\myserver\\d
>


>Admittedly, when I said "Win32" I should have said "Microsoft."  My intent
>was to convey the fact that Microsoft consistently breaks with tradition
in
>this case, just as it breaks with tradition by making everything under its
>direct control (VB/VBScript, T-SQL, IIS, cmd.exe, etc.) case-insensitive.
>

I think that IS keeping a tradition from the ancestor of MS-DOS: CP/M.

>> mkdir( 'C:/foo' ) will work just fine (provided your C drive
>> is writable :
>
>And, of course, the reason this works is because Perl itself is smart
enough
>to handle the slashes.  It has nothing to do with Win32.
>

No, it works because the API function CreateFile (what an intuitive name
for a function used to open files!) *does* understand forward slashes.
I did try this :

#include <windows.h>
#include <stdio.h>

int main(void)
{
  HANDLE h = CreateFile( "C:/autoexec.bat", GENERIC_READ, FILE_SHARE_READ,
                         NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL);
  if( h != INVALID_HANDLE_VALUE )
  {
    CloseHandle( h );
    puts( "success !" );
  }
}

and the open succeeded. (Note that OPEN_ALWAYS means that it either opens
an existing file or creates a new one if it doesn't exist.)


--
Csaba Ráduly, Software Engineer, Sophos Anti-Virus
Email: [EMAIL PROTECTED], Tel: 01235 559933, Web: www.sophos.com
Add live virus info to your website: http://www.sophos.com/link/vfeed


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to