I am writing a program in C# that will extract five files from a .DAT file. I have the original file along with their extensions which are a .pdf, .tif, .txt, and two .docx files saved on my computer for reference.
My question is, how am I supposed to know when the a specific file like say .pdf beings and ends and another begins? I have looked at the hexadecimal version of the .DAT file and was thinking about spotting a certain piece of it to reference and know hey that's a .pdf file and this is where it ends. I don't know if this is correct or not which is why I need some help figuring out when the files end and start. Do I have to go in there by hand and count the hexadecimal digits and see what they are actually in terms of different files? That would seem like a hassle but if I have to I will do it.
If you have any ideas about how to do this, please elaborate!
What I have tried:
I so far have written code that will turn the file data from bytes to hex and vice versa and does work as I have verified this with the .tif, and .pdf files.