Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - fscanf and fprintf
fscanf and fprintf

// Get 2 int data from the file handle fp and assign them to a and b respectively

fscanf(fp,"%d%d",&a,&b);

// Write the values ??of a and b to the file pointed to by the file handle fp, "%d %d" is the writing format.

fprintf(fp,"%d % d",x,y);

The two are similar to scanf and printf without the prefix f, just because the former interacts with files, while the latter interacts with the terminal.