المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : How to convers a binary file into something readable



C++ Programming
03-30-2009, 06:14 PM
Greetings fellows!
I once again ask for you help:

I have some .dat files, which are sequences of bits (files are around 15 MBs in size). Every 10 bits there is a 0 (separator). Before anything else, I would like to make a text file out of the dat one, and every bit in the original file to have a character correspondent in the text file (so I can actually read the bits with , say, notepad).

What I`ve tried so far (without success):

BYTE buffer[100]; //4096
char buffer2[5000];
long index;
DWORD dwRead;

do {
dwRead = readFile.Read(buffer, 100); //4096 in the end, for now working with smaller numbers
for (index=0;index
buffer2[index]= buffer[index]
writeFile.Write(buffer2, dwRead);
}
while (dwRead > 0);

I know it`s goofy and that formatting these bits should be done easily using some unknown (to me) function. Could u please point me the direction?

Thanks again
shpid3r