To get the type of file we can execute the command
system("file --mime-type -b filename");
The output displays in to terminal.But could not store the file type using the command
char file_type[40] = system("file --mime-type -b filename");
So how to store file type as a string using system(file) function.