假设我想读入数字 1 乘以数字 4
5000 49 3.14 Z 100
0322 35 9.21 X 60
目前我有,但只能复制信息而不能操纵信息
#include <stdio.h>
#include <stdlib.h>
#define FILE_1 "File1.txt"
#define FILE_2 "File2.txt"
int main (void)
{
// Local Declarations
char score;
int curCh;
int count = 0;
FILE* sp1;
FILE* sp2;
if (!(sp1 = fopen (FILE_1, "r"))) //check if file is there
{
printf ("\nError opening %s.\n", FILE_1);
return (1);
} // if open error
if (!(sp2 = fopen (FILE_2, "w")))
{
printf ("\nError opening %s.\n", FILE_2);
return (2);
} // if open error
while((curCh = fgetc(sp1)) != EOF)
{
printf ("%c", curCh); //copy the contents
count++;
} // while
return 0;
}