Hey guys. I just learn about magic numbers today. I am trying to make a program that uses fstream along with magic numbers to tell what a file is. Example the magic numbers for jpg are ff d8 ff e0. How do i check a file to see if its a jpg using these numbers. I want to read the first part of the file from my understanding of magic numbers. They should be at the top of the file. A simple example of how to read using magic numbers would be appreciated
slygoth 0 Light Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
raptr_dflo 48 Posting Pro
slygoth 0 Light Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.