- For some unknown reason, a single fopen(path,"rb") fails with certain paths, like "c:\documents and settings\proprietário\meus documentos\meus arquivos recebidos\teste.nes". Any specific reason to fail? o.O
It could possibly be due to the á, though I wouldn't expect that to cause problems with it.
Fx3 wrote:
- For some unknown reason, a single fopen(path,"rb") fails with certain paths, like "c:\documents and settings\proprietário\meus documentos\meus arquivos recebidos\teste.nes". Any specific reason to fail? o.O
File/dir permissions perhaps?
Ahh yes Win2k filepaths how lovely. Well anyway you must be sighned on as the user proprietário to accsess thatdirectoryanyway.Youcould also sign on as the local Administrator then accses it. You could also sign on as proprietário and tell the folder that certan other users can accses it.
Your results may vary due to a different lagage of operateing system. Or between Win2k and WinXP but the princaple is still the same.
If you type a path in C(++,#) or Java, don't forget you need to use two \'s so it doesn't think you're using another escape sequence.
And even on Windows, fopen() accepts forward slashes in paths.
tepples wrote:
And even on Windows, fopen() accepts forward slashes in paths.
Windows doesn't provide fopen, though -- libc does. Which means the behavior depends on the compiler -- whether it's Visual C, gcc, MinGW, Digital Mars, ...
At least all environments that use msvcrt.dll (GCC MinGW, GCC Cygwin with -mno-cygwin, and Microsoft Visual C++) seem to behave as I described. In fact,
this page claims that Win32's CreateFile() supports both '\\' (backslash) and '/' (forward slash), especially given that the MS-DOS kernel accepted both kinds of slashes. You may be confused because command.com reserved '/' for switches (and so does cmd.exe), but almost any MS-DOS or Win32 program that uses '-' for switches will Do The Right Thing with '/' in paths.
Theres no reason why not. But the cmd in Win2k is still affected by the privlages set by windows.
When it fails, what does perror() print? (Or if you can't use standard error because you're in a pure-GUI environment, what does strerror(errno) return?) If "no such file or directory", then it's probably the accented character, and you'll need to set your character encoding (or "code page").
tepples wrote:
At least all environments that use msvcrt.dll (GCC MinGW, GCC Cygwin with -mno-cygwin, and Microsoft Visual C++) seem to behave as I described. In fact,
this page claims that Win32's CreateFile() supports both '\\' (backslash) and '/' (forward slash), especially given that the MS-DOS kernel accepted both kinds of slashes. You may be confused because command.com reserved '/' for switches (and so does cmd.exe), but almost any MS-DOS or Win32 program that uses '-' for switches will Do The Right Thing with '/' in paths.
Not confused i am about switches. I was clarifying a possibly misleading statement, and provided an example of an application not importing from msvcrt (such as cygwin-gcc by default).
danimal wrote:
If you type a path in C(++,#) or Java, don't forget you need to use two \'s so it doesn't think you're using another escape sequence.
Fx3 said that it only fails with "certain paths," so the \ is unlikely to be the problem. In case it matters, "proprietário" is Portuguese for "owner" (correct me if I'm wrong).