Advertisement
fteussh

coder_1.1.1

Oct 30th, 2015
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. #include <cstdio>
  4. #include <stdio.h>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int f_encode (char *file_name) {
  10.  cout << "Function for encoding file" << endl;
  11.  
  12.   FILE * file_object;
  13.      file_object = fopen (file_name, "r");
  14.       if (file_object != NULL)
  15.     cout << "it`s success!!1111!!11azaza" << endl;
  16.      
  17.       if (file_object == NULL) {
  18.     cout << "what the shit?" << endl;
  19.     return 1;
  20.       }
  21.      
  22.      fclose (file_object);
  23. }
  24.  
  25. int f_decode (char *file_name) {
  26.  cout << "Function for decoding file" << endl;
  27.  
  28.  FILE * file_object;
  29.      file_object = fopen (file_name, "r");
  30.      
  31.       if (file_object != NULL)
  32.     cout << "it`s success!!1111!!11azaza" << endl;
  33.    
  34.       if (file_object == NULL) {
  35.     cout << "what the shit?" << endl;
  36.     return 1;
  37.       }
  38.      
  39.      fclose (file_object);
  40. }
  41.  
  42.  
  43. int main (int argc, char **argv) {
  44.  
  45.   if ((argv[1] != NULL) && (argv[2] != NULL)) {
  46.     if (strcmp(argv[1], "encode") == 0) {
  47.     f_encode(argv[2]);
  48.     } else {
  49.     if (strcmp(argv[1], "decode") == 0) {
  50.         f_decode(argv[2]);
  51.     } else {
  52.     cout << "You shall not pass! What the " << argv[1] << "????" << endl;
  53.     return 1;
  54.     }
  55.     }
  56.   } else {
  57.     cout << "What do you mean by saying it..?" << endl;
  58.   }
  59.  
  60.   return 0;
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement