- 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 for file Transfer using UDP
- C Program to find size of a File
- Lex program to search a word in a file
- C program to append content of one text file to another
- C Program to count the Number of Characters in a File
- C program to reverse the content of the file and print it
- 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
- Lex Program to print the total characters, white spaces, tabs in the given input file
- C program to print odd line contents of a File followed by even line content
- C program to find and replace a word in a File by another given word
- What is data type of FILE in C ?
- Basics of File Handling in C
- How to Remove the Password from a Zip File?
- fsetpos() (Set File Position) in C
- C | File Handling | Question 4
- C | File Handling | Question 3
- C | File Handling | Question 2
- C | File Handling | Question 1
- How to Delete a File or Folder using CMD?
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.