in reply to Removing Bad Characters from a String
Why don't you just try creating the file, and see if it succeeds or returns an error? See what error it gives if you create a file with a wrong filename (EINVAL maybe?) and check for that error.