+ 1
Problem in windows 8.1 filename return
I made a program in C which had arguments in main() in order to open a file when clicked, since windows uses the CMD in the background. There where no problems until I tried it with a particular file. I found that the string that returned windows (which corresponds to where the file is) was between double quotation marks (") in some cases, such as strings that contain 'à'. When the file was accessed, it failed, since it is not the position. I managed to remove que double quotation marks, but I wanted to know why this happens and which otherwise exceptions are there. Thanks in advance 😊
5 Respuestas
+ 2
IIRC, Windows wrap quotes around a path when it contains spaces, or non ASCII character (i.e. Unicode character) such as that 'à' you saw. It is a tricky task when dealing with filenames, especially if the filenames are written with non ASCII character. Search for Unicode string handling if you're working with such cases.
Good luck! 👍
+ 4
Vicent,
You're welcome! and please, do share your findings and hopefully solution with this community, it might be useful for someone sooner or later.
My apologies I couldn't help you any further cause am still learning myself. I was expecting someone more experienced to drop an opinion here before actually : )
Well best of luck mate! 👍
+ 1
Real thanks!
I did not want to answer until I had tested it a bit. Apparently, à is extended ASCII, but it did the same with the hysteresis symbol
(according to my hexadecimal editor is FF8E23).
However, the printf outputs a single ? instead of it despite being a three byte character.
It then creates the ciphered or deciphered file without problems containing that character in the name as expected.
Note: my program removes the quotes.
I'll test it and translate it and I will post it in case anyone wants to take a look
+ 1
https://code.sololearn.com/cT4QwkMGGE9w/?ref=app
I've seen to have seen it. I've just detected a problem with large files. I'm trying to solve it right now
+ 1
https://code.sololearn.com/c2PqqoDCjJyU/?ref=app
Here it is. There's a URL to the previous code (now the old one it's private so it may only be accessed from here).
The error was that I was reading chars instead of bytes, which caused problems with images, since they contain strange values for characters with which the program would probably act like it acts with spaces and decide go to the next character. These are just guesses though.
I did realize the created files were shorter.
Edit: notice me I anyone notices any bugs. Although it seems to work, I would not delete the original file without checking it will be recovered correctly, just in case I missed something.