Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.62 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <conio.h>
  5. #include <ctype.h>
  6. #include <ctype.h>
  7. #include <time.h>
  8. #include <sys/types.h>
  9. int main ( void )
  10. {
  11. static const char filename[] = "data.txt";
  12. FILE *file = fopen ( filename, "r" );
  13. int i, j;
  14. char arra[128][128];
  15. char line[128];
  16. for(i=0; i<128; i++)
  17. for(j=0; j<128; j++)
  18. arra[j] = '\0';
  19. for(i=0; i<128; i++)
  20. line = '\0';
  21. if ( file != NULL )
  22. {
  23. i=0;
  24. while ( fgets ( line, sizeof line, file ) != NULL )
  25. {
  26. strcpy(arra, line);
  27. printf("array ----> %s ", &arra);
  28. i++;
  29. }
  30. fclose ( file );
  31. }
  32. else
  33. {
  34. perror ( filename );
  35. }
  36. return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement