Guest User

Untitled

a guest
Dec 12th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     char inputfilename[15];
  7.     char outputfilename[15];
  8.     char keyfilename[15];
  9.     char lowercaseonly[10000];
  10.     char encryptedtext[10000];
  11.     int tempholder;
  12.     int matrix_size;
  13.     int matrix_size2;
  14.     int matrix[matrix_size][matrix_size];
  15.     int matrix_row;
  16.     int matrix_column;
  17.     int entryerror = 1;
  18.     int plaintextcounter = 0;
  19.     int encryptcounter = 0;
  20.     int plaintexttoencrypt[matrix_size];
  21.     int cyphertext[matrix_size];
  22.     int plaintextlength;
  23.     int padlength;
  24.     int padlengthcounter;
  25.     int encrypttemp;
  26.     FILE *keyfile;
  27.     FILE *inputfile;
  28.    
  29.     while (entryerror == 1) {
  30.          printf ("Please enter the name of the file storing the key.\n");
  31.          scanf ("%s", &keyfilename);
  32.          keyfile = fopen( keyfilename, "r");
  33.          if ( keyfile == 0 ){
  34.               printf ("Could not open file please check name and try again.\n");
  35.          }
  36.          else  {
  37.               entryerror=0;
  38.          }
  39.     }
  40.    
  41.     matrix_size = fgetc(keyfile);
  42.     matrix_size = matrix_size - '0';
  43.        
  44.     for ( matrix_row = 0 ; matrix_row < matrix_size ; matrix_row ++ )
  45.     {
  46.         for ( matrix_column = 0 ; matrix_column < matrix_size ; matrix_column ++ )
  47.         {
  48.             fscanf(keyfile, "%i", &matrix[matrix_row][matrix_column]);
  49.             printf ("%i %i \n", matrix_row, matrix_column);
  50.         }
  51.    
  52.     printf (" \n");
  53.     }
  54.    
  55.     fclose(keyfile);
Add Comment
Please, Sign In to add comment