Start C validating filename

C validating filename

I'm working in straight C, but targeting the Win32 API.

Absolute or relative path names may contain file links such as symbolic (soft) links, hard links, shortcuts, shadows, aliases, and junctions.

These file links must be fully resolved before any file validation operations are performed.

More than one path name can refer to a single directory or file.

Further, the textual representation of a path name may yield little or no information regarding the directory or file to which it refers.

Build log was saved at "file://C:\Documents and Settings\Justin\Desktop\isvalidfilename_demo\Is Valid File Name Test\Debug\Build Log.htm" Is Valid File Name Test - 13 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== One other question.

When the app runs, does it monitor the entire file system?

For example, on Windows-based desktop platforms, invalid path characters might include ASCII/Unicode characters 1 through 31, as well as quote ("), less than ( Universal Windows Platform Available since 8 .

NET Framework Available since 2.0 Portable Class Library Supported in: portable .

Get Invalid File Name Chars() // Returns an array of characters that cannot be used in a file name Path. The Uri class isn't just useful for web URLs, it also handles file system paths as well. Try Create method to find if the path is rooted then use the Is Loopback property to determine if the Uri references the local machine.

Get Invalid Path Chars() // Returns an array of characters that cannot be used in a path. Here is a simple method which determines if a string is a valid, local, and rooted file path. If you won't be thrashing the disk with hundreds of files in a short period of time, I think creating an empty file is a reasonable approach.

If you really want something lighter, like just checking for invalid chars, then compare your filename against Path. This does not appear to be true, at least in Mono (e.g.