test last 4 characters

how do i test an input's last 4 characters... i want to make sure that the user input ends in .csv ...

Not getting anywhere!!!


Which type is the variable you stored the input in?
Reverse it, see if it starts with "vsc.", then reverse it again. :-)
its just a normal cin assignment... i think thats char...
If is a char array, try this:

1
2
if ( !strcmp(".csv", input+strlen(input)-4) )
    //last characters are ".csv" 

Topic archived. No new replies allowed.