On older versions of Windows, it didn't work that way, but you are correct on Win XP.

Honestly, Windows 3.1 is a whole other world. It wasn't even an OS.

Not 100% sure, so prove me wrong if a newer Windows doesn't support "/" as the dir separator. Test code below.

Update: not quite right...

What isn't quite right? You (falsely) make it sound like something I said was wrong.


Test to determine if your Windows supports "/" as the directory separator:

>copy con a.cpp #include <windows.h> #include <stdio.h> int main(int argc, char* argv[]) { if (argc != 2) { fprintf(stderr, "usage: %s filename\n", argv[0]); return 1; } HANDLE file = CreateFile( argv[1], GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ); if (file == INVALID_HANDLE_VALUE) { fputs("An error occured\n", stderr); return 1; } return 0; } >cl a.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for +80x86 Copyright (C) Microsoft Corp 1984-1998. All rights reserved. a.cpp Microsoft (R) Incremental Linker Version 6.00.8168 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /out:a.exe a.obj >a .\a.exe >a ./a.exe

In reply to Re^4: Trouble using a Win32 file path in an array by ikegami
in thread Trouble using a Win32 file path in an array by geo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.