Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ypedef struct nb{
- int n;
- char txt[512];
- char comando[512];
- char resultados[1024]
- };
- int leNb(struct nb v[]){
- int nr = 0,i=0;
- char l[512];
- char s[512];
- char seps[] = " ";
- char *token;
- struct nb arr_nb[Max];
- FILE *file = fopen("teste.nb","r");
- if (file== NULL){
- perror("erro");
- _exit(-1);
- }
- //printf("Merda\n");
- while(fgets(l, sizeof l, file)!=NULL){
- arr_nb[i].n = nr;
- strcpy(s,l);
- token = strtok(s, seps);
- if(strcmp(token,"$")==0 ||strcmp(token,"$|")==0){
- strcpy(arr_nb[i].comando,l);
- //printf("comando %d -> %s\n",i,arr_nb[i].comando);
- }
- strcpy(arr_nb[i].txt, l);
- //printf("doc %d -> %s\n",i, arr_nb[i].txt);
- v[i] = arr_nb[i];
- nr++;
- i++;
- }
- fclose(file);
- return i;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement