- 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:
- C Program to Check Whether a Number is Prime or not
- C Program to check whether a number is a Perfect Cube or not
- C/C++ Program to check whether it is possible to make a divisible by 3 number using all digits in an array
- C program to Check Whether a Number is Positive or Negative or Zero
- Lex program to check whether input number is odd or even
- C program to check whether a given number is even or odd
- Check whether the given character is in upper case, lower case or non alphabetic character
- Check whether the number can be made perfect square after adding 1
- Check whether the given string is Palindrome using Stack
- Program to check if a number belongs to a particular base or not
- C program to check if a given string is Keyword or not
- C Program to find whether a no is power of two
- Write a C program that displays contents of a given file like 'more' utility in Linux
- C Program for Lower Case to Uppercase and vice-versa in a file
- C program for file Transfer using UDP
- C Program to find size of a File
- Lex Program to print the total characters, white spaces, tabs in the given input file
- Lex program to search a word in a file
- C Program to count the Number of Characters in a File
- C program to find and replace a word in a File by another given word
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.