Hi!
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();
  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...

Recommended Answers

All 2 Replies

What is it - a file binarization?

I've solved the problem already, thx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.