This is C code to get all the file names in the directory. Here I want to only specific format files. Format example I would like to list out only .txt files . How can I change this code to list out only specific formats ?
you would just have to parse de->d_name
when you hit a . you know everything already parsed is the file name and everything not yet parsed is the extension. i would suggest using strtok() to tokenize the name but you also have to be careful because in nix systems you dont have to have an extension for it to be a valid file.