Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int main(int argc, char *argv[]){
- int i=0,max=0,vesszo=0;
- char nev[50],k;
- FILE *f;
- f=fopen(argv[1],"r");
- while(k != EOF){
- k = fgetc(f);
- if(k == ';'){
- vesszo++;
- }
- if(k == '\n' || k == EOF){
- if(vesszo > max){
- max = vesszo;
- }
- vesszo = 0;
- }
- }
- rewind(f);
- vesszo = 0;
- k='a';
- printf("%d\n", max-2);
- while(k != EOF){
- k = fgetc(f);
- if(k == ';'){
- vesszo++;
- }
- if(vesszo == 0){
- nev[i] = k;
- ++i;
- nev[i] = '\0';
- }
- if(k == '\n' || k == EOF){
- if(vesszo == max){
- printf("%s\n",nev);
- }
- vesszo = 0;
- i=0;
- }
- }
- fclose(f);
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement