kk258966

5/28 C++ 練習二

May 28th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. int main(void)
  5. {
  6.     FILE *written;
  7.     written=fopen("student.txt","w");
  8.     fprintf(written,"資管系");
  9.     fclose(written);
  10.    
  11.     FILE *read;
  12.     read=fopen("student.txt","r");
  13.     char string[100];
  14.    
  15.     while (fgets (string, 65535,read))   //65535 緩衝  
  16.     {
  17.           printf("%s\n",string);
  18.           }
  19.           fclose(read);
  20.    
  21.    
  22.    
  23.     system("pause");
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment