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[2];
  ifstream messageFile(filename);
  beginFile = messageFile.tellg();
  messageFile.seekg (0, ios::end);
  endFile = messageFile.tellg();
  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...

What is it - a file binarization?

I've solved the problem already, thx.