Imagine that I have two strings, one of them is a url like \"/sdcard/test.avi\" and the other one is\"/sdcard/test.mkv\". I want to write an if statement that looks whether
#include
#include
int main(void)
{
DIR *dir;
struct dirent *ent;
char files[100][500];
int i = 0;
memset(files, 0, 100*500);
dir = opendir ("/sdcard/");
if (dir != NULL)
{
/* Print all the files and directories within directory */
while ((ent = readdir (dir)) != NULL)
{
strcpy(files[i], ent->d_name);
if(strstr(files[i], ".avi") != NULL)
{
printf("\n files[%d] : %s is valid app file\n", i, files[i]);
i++;
}
}
closedir (dir);
}
return 0;
}