1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main()
{
FILE *fp,*fpp;
char bla[200][40];
char abi[2000] = "";
int koht=0,i=0,j=0;
char mark;
fp = fopen("Teaduskond.txt","r");
fpp = fopen("Storage.txt","w");
while(!feof(fp)){ //do until the end of file
fgets(abi,200,fp); // get a line
koht=0;mark=abi[koht];
do{ //check each char
mark=abi[koht++];
switch(mark){
case '.': fprintf(fpp," ");break; // ASCII does not like the
case 'ü': fprintf(fpp,"u");break; // Estonian alphabet letters
case 'õ': fprintf(fpp,"o");break;
case 'ä': fprintf(fpp,"a");break;
case 'ö': fprintf(fpp,"o");break;
}
if(isalnum(mark)){
fputc(mark,fpp);
}
if(isspace(mark)){
fputc(mark,fpp);
}
}while(mark); //end of row
} //end of file
fclose(fp);
fclose(fpp);
fpp = fopen("Storage.txt","r");
while(!feof(fpp)){ // go through the cleaned(words and spaces) file
fgets(abi,200,fpp);
koht=0;mark=abi[koht];
do{
mark=abi[koht++];
bla[i][j]=mark;
j++;
if(isspace(mark)){
i++;
continue;
}
}while(mark);
}
fclose(fpp);
printf("\n\nHit something...");
getch();
return 0;
}
|