Validate a filename
-
How do you know if a combination of a path and filename is valid ? I don't want to know if it is an actual existing file but only if it's valid (does not contain any invalid caracters). Also, I do not want to create a file on the disk to know if I'll receive an invalid filename error. So, how can I know if a path + filename combination has a valid syntax ? (example: "C:\folder name\file name.ext" is valid, "C:\folder name\file&?n!.ext" is invalid) I'm using C++ only (no MFC, etc). Thanks a lot ! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= J.-C. Gauthier - http://www.grandmenhir.com/
-
How do you know if a combination of a path and filename is valid ? I don't want to know if it is an actual existing file but only if it's valid (does not contain any invalid caracters). Also, I do not want to create a file on the disk to know if I'll receive an invalid filename error. So, how can I know if a path + filename combination has a valid syntax ? (example: "C:\folder name\file name.ext" is valid, "C:\folder name\file&?n!.ext" is invalid) I'm using C++ only (no MFC, etc). Thanks a lot ! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= J.-C. Gauthier - http://www.grandmenhir.com/
-
How do you know if a combination of a path and filename is valid ? I don't want to know if it is an actual existing file but only if it's valid (does not contain any invalid caracters). Also, I do not want to create a file on the disk to know if I'll receive an invalid filename error. So, how can I know if a path + filename combination has a valid syntax ? (example: "C:\folder name\file name.ext" is valid, "C:\folder name\file&?n!.ext" is invalid) I'm using C++ only (no MFC, etc). Thanks a lot ! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= J.-C. Gauthier - http://www.grandmenhir.com/
This article titled "Making Room for Long Filenames" in the location "Windows Base Services General Technical Articles " of the MSDN Library has a few general guidelines for long filenames, and they include: - The application must not use the following characters in directory names or filenames, because they are reserved for Windows: < > : " / \ | - The application must not use reserved words, such as aux, con, and prn, as filenames or directory names. The documentation forgot to mention that asterisk (*) and the question mark (?) are also invalid characters.
-
Unfortunately, I do not want to do that (like mentionnend in the original post) Its a possible solution but I would like to use only if everything else should fail :)