C program to check whether the file is JPEG file or not
- We will give an image as a command line argument while executing the code.
- Read the first three bytes of the given image(file).
- After reading the file bytes, compare it with the condition for JPEG file i.e., if the first, second, and third byte of the given file is 0xff, 0xd8, and 0xff respectively then the given file is JPEG file.
- Else it is not a JPEG File.
Below is the implementation of the above approach:
My Personal Notes arrow_drop_up