#include "stdafx.h"
#include "stdlib.h"

 

int main()
{
 /* 檔案讀寫入門
 FILE *f;
 int n;

 f = fopen("test.txt", "r"); //r=讀 w=寫

 fscanf(f,"%d", &n); //讀入檔案
 printf("%d", n);
 //fprintf(f, "10"); 寫入檔案

 fclose(f);
 */
 
 /*小考 檔案讀寫實作
 FILE *read_1;
 FILE *write_1;
 int nb;
 int *temp;
 
 read_1 = fopen("test.txt", "r");
 write_1 =  fopen("write.txt", "w");
  fscanf(read_1, "%d", &nb);
  printf("%d", nb);
  temp = (int *)malloc(nb*4);
   for(int i=0; i<nb; i++)
   {
    fscanf(read_1, "%d", temp+i);
    fprintf(write_1, "%d\n", temp[i]+10);
   }
  free(temp);
 fclose(write_1);
 fclose(read_1);
 */

 return 0;
}

 

AwEi 發表在 痞客邦 PIXNET 留言(0) 人氣()