How to check for dot in a string

So , i need to check if a string has a dot, if not, the user needs to input until a string with a dot is provided.
something like this, the user needs to provide something like exmaple.txt, or .dat

Enter Input File Name: example
Error, invalid file name.

Enter Input File Name:

If you can find "." from the string ...
http://www.cplusplus.com/reference/string/string/find_first_of/
FYI the major operating systems all allow files without a dot. Most of the text files I use even on windows are extensionless.

if you are going to do a large # of checks, like every file on your disk, find may be slightly slower than a dumb loop as it does more work than is needed. You won't notice this until the number of names you test becomes extremely large.
Last edited on
Topic archived. No new replies allowed.