Advertisement
ecco7777

count-dir-file

May 28th, 2015 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6.     int txt[100];
  7.     int x = 0;
  8.     system("dir > ausg.txt");
  9.     FILE*fp=fopen("ausg.txt","r");
  10.        if(fp == NULL)
  11.    {
  12.       perror("Error in opening file");
  13.       return(-1);
  14.    }
  15.    do
  16.    {
  17.        x++;
  18.       txt[x] = fgetc(fp);
  19.  
  20.       printf("%c", txt[x]);
  21.    }while( feof(fp)==0 );
  22.     fclose(fp);
  23.     printf("%c",txt[x]);
  24.  
  25.  
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement