Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char inputfilename[15];
- char outputfilename[15];
- char keyfilename[15];
- char lowercaseonly[10000];
- char encryptedtext[10000];
- int tempholder;
- int matrix_size;
- int matrix_size2;
- int matrix[matrix_size][matrix_size];
- int matrix_row;
- int matrix_column;
- int entryerror = 1;
- int plaintextcounter = 0;
- int encryptcounter = 0;
- int plaintexttoencrypt[matrix_size];
- int cyphertext[matrix_size];
- int plaintextlength;
- int padlength;
- int padlengthcounter;
- int encrypttemp;
- FILE *keyfile;
- FILE *inputfile;
- while (entryerror == 1) {
- printf ("Please enter the name of the file storing the key.\n");
- scanf ("%s", &keyfilename);
- keyfile = fopen( keyfilename, "r");
- if ( keyfile == 0 ){
- printf ("Could not open file please check name and try again.\n");
- }
- else {
- entryerror=0;
- }
- }
- matrix_size = fgetc(keyfile);
- matrix_size = matrix_size - '0';
- for ( matrix_row = 0 ; matrix_row < matrix_size ; matrix_row ++ )
- {
- for ( matrix_column = 0 ; matrix_column < matrix_size ; matrix_column ++ )
- {
- fscanf(keyfile, "%i", &matrix[matrix_row][matrix_column]);
- printf ("%i %i \n", matrix_row, matrix_column);
- }
- printf (" \n");
- }
- fclose(keyfile);
Add Comment
Please, Sign In to add comment