C....Search a string for a string
Does anybody know of a function or have a code example that searches a string, for contents of another string? For example, I would like C program to look at file names, and be able to search each "filename/string" for ".exe".
Thanks. :study: |
Code:
if (strstr(myfilename, ".exe")!=NULL) Enjoy! |
Thanks!!
|
If you want to make sure that ".exe" are the last 4 characters in the filename, then this approach might be better:
Code:
if(strlen(filename) > 4) |
Quote:
Since he is doing this for Windows (at least I think he is, why else .exe?), then this would probably be even better: Code:
if(strlen(filename) > 4) |
All times are GMT -5. The time now is 12:42 PM. |