given file name find its type using metadata in linux using c code example

Example 1: read string by string in file in linux

grep 'word' filename
grep 'word' file1 file2 file3
grep 'string1 string2'  filename
cat otherfile | grep 'something'
command | grep 'something'
command option1 | grep 'data'
grep --color 'data' fileName

Example 2: create a file in the directory of the exe and write to it c#

string GuarnteedWritePath = System.Environment.
                             GetFolderPath(
                                 Environment.SpecialFolder.CommonApplicationData
                             );
            string FilePath = Path.Combine(GuarnteedWritePath, "LogFile.txt");