0

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...

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by gyagyus
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.