Hi,
I am having three different files. 'File1.c' is written in C language , 'File2.cpp' is written in C++ language and 'File3.dat' is a datafile(say Ascii). On Unix when I try to test the file type without opening the file using the command
It is the same for all three files.
Then I wrote a perl script checking whether any C type comments(/* */) or C++ comments(//) existing.
Is there any betterway(any perl function) to check the file belongs to which language C/C++ or a textfile without opening it?
In reply to file type
by ashok