Advertisement
Guest User

Untitled

a guest
May 27th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. int main(void){
  7.     size_t n;
  8.     int i;
  9.     char *p, *a[512], *str, *b[512], *res; 
  10.     FILE *fp=fopen("set.txt","r");
  11.     getline(&str, &n, fp);
  12.     if (n > 512) {
  13.         printf("Size fault\n");
  14.         return -1;
  15.     }
  16.     p = strtok(str, " ");
  17.     a[0]=p;
  18.     printf("%s\n",a[0]);
  19.     i=1;
  20.     while(p != NULL)
  21.     {  
  22.         p=strtok(NULL, " ");
  23.         a[i]=p;
  24.         printf("%s\n", a[i]);
  25.         i++;   
  26.     }
  27.    
  28.     //for ()
  29.  
  30.     fclose(fp);
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement