Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to write plastic array data into file with C language
How to write plastic array data into file with C language
# include & ltstdio.h & gt

int main()

{

FILE * file = NULL

int a[5][5],I,j;

for(I = 0; I<5; i++)

for(j = 0; j & lt5; j++)

a[I][j]= 5 * I+j;

if((file = fopen("a.txt "," w+"))! = empty)

{

for(I = 0; I<5; i++)

{

for(j = 0; j & lt5; j++)

fprintf(file," %-8d ",a[I][j]);

Fprintf (file, "\ n");

}

Fclose (file);

}

Returns 0;

}