actual code.txt.txt

3
#include <stdio.h> #include <conio.h> typedef struct key{ //Declare a sturcture in order to store the key s char first; char second; }key; key alp[52]; //As we have 52 lines in key file,we have to tak e an array of sturture of 52 elements to store there keys int read_key(char *); //This function will read the file which contain the keys and will store them in the structure elements void init(void); //This function just initilize the structure eleme nts with Null; void buffer(void); //This function is just for emergency use,some time s it happens to clean the buffer,but this program did not use this function int read_and_replace(char *plane); /*This is the main function,it will read th e input file and at the same time store the modified words in output file until i nput file is not finished */ void init () //Definition of init function { int i; for(i=0; i<=52; i++) { alp[i].first =0; alp[i].second=0; } } void buffer() { char c; do scanf("%c",&c); while(c!='\n'); } int read_key(char *key) { int i=0; char templine[10]; //this string is to store the content of a single line of key file FILE *fkey; fkey=fopen(key,"r"); //open key file for reading if(fkey==NULL) return -1; else { while(!feof(fkey)) { fgets(templine, 10, fkey); sscanf(templine,"%c %c",&alp[i].first,&alp [i].second); /*As we kno w each line contain only two elements,so to store these two eleme nts in the structure*/ i++;

Upload: rizwan-hameed

Post on 04-Apr-2018

221 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Actual code.txt.txt

7/29/2019 Actual code.txt.txt

http://slidepdf.com/reader/full/actual-codetxttxt 1/3

Page 2: Actual code.txt.txt

7/29/2019 Actual code.txt.txt

http://slidepdf.com/reader/full/actual-codetxttxt 2/3

Page 3: Actual code.txt.txt

7/29/2019 Actual code.txt.txt

http://slidepdf.com/reader/full/actual-codetxttxt 3/3