#include
#include
int main(void) {
char name[] = "file.cf";
char nona[] = "file.db";
printf("testing for `.db' extension\n");
printf("--\n");
if(strcmp((name + (strlen(name) - 3)), ".db"))
printf("NOT valid : %s\n", name);
else
printf("valid : %s\n", name);
if(strcmp((nona + (strlen(nona) - 3)), ".db"))
printf("NOT valid : %s\n", nona);
else
printf("valid : %s\n", nona);
printf("\n");
return 0;
}
#include
int main(void) {
char name[] = "file.cf";
char nona[] = "file.db";
printf("testing for `.db' extension\n");
printf("--\n");
if(strcmp((name + (strlen(name) - 3)), ".db"))
printf("NOT valid : %s\n", name);
else
printf("valid : %s\n", name);
if(strcmp((nona + (strlen(nona) - 3)), ".db"))
printf("NOT valid : %s\n", nona);
else
printf("valid : %s\n", nona);
printf("\n");
return 0;
}
No comments:
Post a Comment