3 ms·
fopen will/should fail on windows with the unix path syntax. The reason it's indeterminate is because some stdc lib vendors will do path translation on Windows
by manv1 4y ago
fopen will/should fail on windows with the unix path syntax.
The reason it's indeterminate is because some stdc lib vendors will do path translation on Windows, some won't. I believe cygwin does (because it's by definition a unix-on-windows), but I'm pretty sure the normal stdclib vendors on windows do not.
I'm almost positive that MacOS (before MacOS X) will fail with unix path separators, since path separators are ':' not '/'.
- spc476 4y agoIt will work on Windows, since it inherits the behavior from MS-DOS. It's the shell on Windows (or MS-DOS) where it fails since the shell uses '/' to designate options, so when MS-DOS gained subdirectories (2.0) it used '\' as the file separator on the shell. The "kernel" will accept both. There even used to be an undefined (or underdefined) function in MS-DOS to switch the option character.
- manv1 4y agoApparently it's true. I wonder when this was implemented? Canonicalize separators "All forward slashes (/) are converted into the standard Windows separator, the back slash (\). If they are present, a series of slashes that follow the first two slashes are collapsed into a single slash." https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats https://learn.microsoft.com/en-us/dotnet/standard/io/file-pa...
- spc476 4y agoSince MS-DOS 2.0, released in October of 1983---39 years ago.