Write a program | Quick Solution

Write a command-line program to determine file type under Unix
When running your program with a file name as the input parameter, it should return the type of the file, such as ‘text file’, ‘executable file’, ‘C source code’, etc.
As we discussed in class, there are four possible ways to determine the type of a file:
Comparing the file extension to a list of known extensions;
By reading the first byte of the file and comparing it to a list of existing magic code;
Examining the return from a stat() system call;
For text files, read the contents of the file and try to figure it out;
For the purpose of this homework, you don’t have to implement all of the above four. Two will suffice. Any file that can’t be recognized should show ‘unknown type’.
Submit your source code and a test run result (either a ‘script’ file, or a screenshot).

Don't use plagiarized sources. Get Your Custom Essay on
Write a program | Quick Solution
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay
superadmin

Recent Posts

What is the easy difination of science | Quick Solution

Science is the pursuit and application of knowledge and understanding of the natural and social…

3 years ago

definition, values, meaning of such values and type of goods with such elasticity value …….. | Quick Solution

Clearly stating the definition, the values, the meaning of such values and the type of…

3 years ago

Acct 422 – Nora D | Quick Solution

All answered must be typed using Times New Roman (size 12, double-spaced) font. No pictures…

3 years ago

Acct 322 – Nora D | Quick Solution

All answered must be typed using Times New Roman (size 12, double-spaced) font. No pictures…

3 years ago

Macro Economics Question | Quick Solution

https://www.npr.org/sections/ed/2018/04/25/605092520/high-paying-trade-jobs-sit-empty-while-high-school-grads-line-up-for-university Click on the link above. Read the entire link and answer the questions below…

3 years ago

MGT 322 – Nora D | Quick Solution

All answered must be typed using Times New Roman (size 12, double-spaced) font. No pictures…

3 years ago