Answer the question
In order to leave comments, you need to log in
Check first 2 bytes?
Hello. For example, there is a file, I open it. But how do I represent it in binary form so that I can read the first 2 bytes from it? To be specific, I need to compare the first 2 bytes with 0x4D 0x5A. Googled, but still did not understand how to convert the file that I receive through CreateFile () into an array of bytes
Answer the question
In order to leave comments, you need to log in
Open the file in ifstream in binary mode and read 2 bytes with read .
Or use fread . Read 2 bytes into a buffer of length 2.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question