#include <iostream>
#include <fstream>
#include <string>

using namespace std;

inline
void
usage()
{
   cout << "Convert base ten number to binary for 64" << endl;
   cout << "bit unsigned whole number." << endl;
   cout << "Author: Matt Coan" << endl;
   cout << "Date: " << __DATE__ << " " << __TIME__ << endl;
   cout << "usage: long2bin <infile> <outfile>" << endl;
}

#ifdef NO_MAIN
extern "C" {
extern int long2bin_main(int argc, char ** argv);
}
int long2bin_main(int argc, char ** argv)
#else
int
main(int argc, char ** argv)
#endif
{
   if(argc == 3) {
      string infile = argv[1];
      string outfile = argv[2];
      unsigned long long int key = 0L;
      ifstream fin(infile.c_str());
      ofstream fout(outfile.c_str(), ios::out | ios::binary | ios::ate);
      if(fin && fout) {
         fin >> key;
         fout.write((char*)&key,sizeof(unsigned long long int));
         fin.close();
         fout.close();
      }
      else {
         usage();
      }
   }
   else {
      usage();
   }
   return 0;
}
