#include <stdio.h>
#include <string.hpp>
#include <direct.h>
#include <stdlib.h>
void main(){
DIR *dirp;
struct dirent *direntp;
dirp = opendir( ".\\data" );
direntp = readdir( dirp );
int has=0; int sel=1; int sele=0; int stop=0;
printf("Select dictionary:\n");
while( true ) {
if( direntp == NULL ) break;
printf("%d - %s\n",sel,direntp->d_name);
direntp = readdir( dirp );
has=1;
sel++;
}
if(has=1){printf("Enter your choice (1 - %d): ",sel-1);
scanf("%d",&sele);}
if(sele<1 || sele>=sel){printf("Invalid choice!"); exit(0);}
dirp = opendir( ".\\data" );\\opens whr file is
direntp = readdir( dirp ); direntp = readdir( dirp );
sel=0;
while(sel<sele){direntp = readdir( dirp ); sel++; }
printf("Active dictionary: %s\nPress CTRL+C to exit.",direntp->d_name);
String file=direntp->d_name;
char word[80];
while(true){
printf("\nSearch for: ");
scanf("%s",&word);
FILE *fr;
char buffer[80];
fr = fopen( ".\\data\\"+file, "r" );
if( fr != NULL ) {
int cnt=0;
for(int i=0; i<25;i++)
fgets( buffer, 80, fr );
while( fgets( buffer, 80, fr ) != NULL ){
if(strstr(buffer,word)!=NULL){
printf("%s",buffer);
cnt++;
if(cnt>2){printf(" Only first 2 matches listed.\n"); break;}
}
}
fclose( fr );
}
else{
printf("Cannot open dictionary file");
exit(0);
}
}
}
void main(){
DIR *dirp;
struct dirent *direntp;
dirp = opendir( ".\\data" );
direntp = readdir( dirp );
direntp = readdir( dirp );
direntp = readdir( dirp );
int has=0; int sel=1; int sele=0; int stop=0;
if( direntp == NULL ){printf("No dictionary was found in the 'data' directory. "); getchar(); exit(0);}
printf("Select dictionary:\n");
while( true ) {
if( direntp == NULL ) break;
printf("%d - %s\n",sel,direntp->d_name);
direntp = readdir( dirp );
has=1;
sel++;
}
if(has=1){printf("Enter your choice (1 - %d): ",sel-1);
scanf("%d",&sele);}
if(sele<1 || sele>=sel){printf("Invalid choice!"); exit(0);}
dirp = opendir( ".\\data" );
direntp = readdir( dirp ); direntp = readdir( dirp );
sel=0;
while(sel<sele){direntp = readdir( dirp ); sel++; }
printf("Active dictionary: %s\nPress CTRL+C to exit.",direntp->d_name);
String file=direntp->d_name;
char word[80];
while(true){
printf("\nSearch for: ");
scanf("%s",&word);
FILE *fr;
char buffer[80];
fr = fopen( ".\\data\\"+file, "r" );
if( fr != NULL ) {
int cnt=0;
printf("___________________________________________________________\n");
for(int i=0; i<25;i++)
fgets( buffer, 80, fr );
while( fgets( buffer, 80, fr ) != NULL ){
if(strstr(buffer,word)!=NULL){
printf("%s",buffer);
cnt++;
if(cnt>250){printf(" Only first 250 matches listed.\n"); break;}
}
}
fclose( fr );
printf("___________________________________________________________");
}
else{
printf("Cannot open dictionary file");
exit(0);
}
}
}
#include <stdio.h>
#include <string.hpp>
#include <direct.h>
#include <stdlib.h>
void main(){
DIR *dirp;
struct dirent *direntp;
dirp = opendir( ".\\data" );
direntp = readdir( dirp );
int has=0; int sel=1; int sele=0; int stop=0;
printf("Select dictionary:\n");
while( true ) {
if( direntp == NULL ) break;
printf("%d - %s\n",sel,direntp->d_name);
direntp = readdir( dirp );
has=1;
sel++;
}
if(has=1){printf("Enter your choice (1 - %d): ",sel-1);
scanf("%d",&sele);}
if(sele<1 || sele>=sel){printf("Invalid choice!"); exit(0);}
dirp = opendir( ".\\data" );\\opens whr file is
direntp = readdir( dirp ); direntp = readdir( dirp );
sel=0;
while(sel<sele){direntp = readdir( dirp ); sel++; }
printf("Active dictionary: %s\nPress CTRL+C to exit.",direntp->d_name);
String file=direntp->d_name;
char word[80];
while(true){
printf("\nSearch for: ");
scanf("%s",&word);
FILE *fr;
char buffer[80];
fr = fopen( ".\\data\\"+file, "r" );
if( fr != NULL ) {
int cnt=0;
for(int i=0; i<25;i++)
fgets( buffer, 80, fr );
while( fgets( buffer, 80, fr ) != NULL ){
if(strstr(buffer,word)!=NULL){
printf("%s",buffer);
cnt++;
if(cnt>2){printf(" Only first 2 matches listed.\n"); break;}
}
}
fclose( fr );
}
else{
printf("Cannot open dictionary file");
exit(0);
}
}
}
void main(){
DIR *dirp;
struct dirent *direntp;
dirp = opendir( ".\\data" );
direntp = readdir( dirp );
direntp = readdir( dirp );
direntp = readdir( dirp );
int has=0; int sel=1; int sele=0; int stop=0;
if( direntp == NULL ){printf("No dictionary was found in the 'data' directory. "); getchar(); exit(0);}
printf("Select dictionary:\n");
while( true ) {
if( direntp == NULL ) break;
printf("%d - %s\n",sel,direntp->d_name);
direntp = readdir( dirp );
has=1;
sel++;
}
if(has=1){printf("Enter your choice (1 - %d): ",sel-1);
scanf("%d",&sele);}
if(sele<1 || sele>=sel){printf("Invalid choice!"); exit(0);}
dirp = opendir( ".\\data" );
direntp = readdir( dirp ); direntp = readdir( dirp );
sel=0;
while(sel<sele){direntp = readdir( dirp ); sel++; }
printf("Active dictionary: %s\nPress CTRL+C to exit.",direntp->d_name);
String file=direntp->d_name;
char word[80];
while(true){
printf("\nSearch for: ");
scanf("%s",&word);
FILE *fr;
char buffer[80];
fr = fopen( ".\\data\\"+file, "r" );
if( fr != NULL ) {
int cnt=0;
printf("___________________________________________________________\n");
for(int i=0; i<25;i++)
fgets( buffer, 80, fr );
while( fgets( buffer, 80, fr ) != NULL ){
if(strstr(buffer,word)!=NULL){
printf("%s",buffer);
cnt++;
if(cnt>250){printf(" Only first 250 matches listed.\n"); break;}
}
}
fclose( fr );
printf("___________________________________________________________");
}
else{
printf("Cannot open dictionary file");
exit(0);
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks