// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <fstream>

int main(int argc, char* argv[])
{
  std::ifstream File(argv[1], std::ios::binary);
  if(!File)
  {
      std::cout << "Failed to open your file" << std::endl;
      return 1;
  }
  File.seekg(0, std::ios_base::end);
  unsigned int Size = File.tellg();
  std::cout << Size << std::endl;
  File.seekg(0, std::ios_base::beg);
  char* data = new char [Size];
  File.read(data, Size);
  std::cout << File.gcount() << std::endl;
  data[Size] = 0;
  std::cout << "I have read: " << std::endl << data << std::endl;
  delete [] data;
}
