I need to find out the size of an arbitrary file and then binarize it in C. I can do this with txt files, but how could I generalize it?
This is how I get the size:
const char* filename = argv; ifstream messageFile(filename); beginFile = messageFile.tellg(); messageFile.seekg (0, ios::end); endFile = messageFile.tellg(); messageFile.close(); fileSize = endFile - beginFile;
Then I read characters from it and binarize them. But what should I do with a pdf or a png? I would appreciate your help...