Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASCII English Text / ASCII C Program Text Question

Tags:

c

linux

Can anyone tell me the difference between ASCII English Text and ASCII C Program Text files. I have been writing a small program and when I use the Linux 'file' command on one of the files it describes it as ASCII English Text whereas all other files are described as ASCII C Program Text. The program compiles but I am getting strange results. This might be unrelated but I cant escape the thought that this is causing the issue.

So what are the difference between these files? Why does the file compile and could this cause issues? Finally how can I convert from ASCII English Text to ASCII C Program Text.

Thanks!

like image 522
JohnB Avatar asked Aug 16 '11 08:08

JohnB


1 Answers

There is no 'magic number' in C source code files, so the file utility can only use some heuristics (like 'if it contains "#include <" in the first few lines) to guess it is a 'C' file. If the file doesn't match any of the heuristics, but contains some English words, then the file utility may guess wrong. Nothing to worry about. The C code is supposed to compile and run well, it is not written just to be identified by file.

like image 66
Jacek Konieczny Avatar answered Sep 28 '22 03:09

Jacek Konieczny