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