mortified_penguin

huff_main.cpp

Dec 29th, 2012
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cstdio>
  4.  
  5. #include "node.hpp"
  6. #include "code.hpp"
  7.  
  8. int main(int, char **argv)
  9. {
  10.    std::string opt(argv[1]);
  11.    std::transform(opt.begin(), opt.end(), opt.begin(), tolower);
  12.  
  13.    if ((opt == "-d" || opt == "--decompress")) {
  14.       decompress de(argv[2]);
  15.       std::cout << de.plaintext();
  16.       return EXIT_SUCCESS;
  17.    } else if (opt == "-c" || opt == "--compress") {
  18.       compress en(argv[2]);
  19.       en.write(argv[3]);
  20.       return EXIT_SUCCESS;
  21.    } else {
  22.       std::cerr << "Invalid argument\n";
  23.    }
  24.    return EXIT_FAILURE;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment