Link to home
Start Free TrialLog in
Avatar of chcw
chcwFlag for Hong Kong

asked on

Which characters will never appear in a file path?

Among 256 characters, which characters will never appear in a valid file path definitely? The operating system is Windows(Language aan be Asian language or other different languages).

I belive 0x00 is one of them. But I need to know the others.
ASKER CERTIFIED SOLUTION
Avatar of cyberkiwi
cyberkiwi
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The following characters are invalid as file or folder names on Windows using NTFS:
/ ? < > \ : * | ” and any character you can type with the Ctrl key

In addition to the above illegal characters the caret ^ is also not permitted under Windows Operating Systems using the FAT file system.
backslash (\) can't appear in a (terminal) filename - but it can be part of a Windows pathname (similarly for forward slash (/) in *n*x systems).  

It wouild also be unwise (and probably not possible) to include any of the 'control code' characters in the pathname, since these usually have no graphic representation.
Control code characters are those with code-points in the range 0-31 (decimal) or 0x00-0x1f (hexadecimal)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of chcw

ASKER

antony_kibble<!-8D58D5C3656518... :

Is there are similar function under Visual C++ 6.0 like GetInvalidPathChars?

To All:

So even for Unicode characters, the following characters will also not be permitted?

•< > : " / \ | ? *
•Characters whose integer representations are 0-31 (less than ASCII space)

Thanks
Avatar of chcw

ASKER

Thanks for all your replys.

I just want to confirm that for Unicode path, the following byte will also appear in NEITHER the first byte of the Unicode character, NOR the second byte of the Unicode character, is that correct?

The following reserved characters:

< (less than)
> (greater than)
: (colon)
" (double quote)
/ (forward slash)
\ (backslash)
| (vertical bar or pipe)
? (question mark)
* (asterisk)
Integer value zero, sometimes referred to as the ASCII NUL character.
Characters whose integer representations are in the range from 1 through 31.

Thanks

Avatar of chcw

ASKER

Thanks