ŠeŠϊ–ˆ‚ΙFile‚πμ¬‚·‚ι

#include ƒstdio.h>
#include ƒstdlib.h>

main(){
 int x;
 FILE *fp;
 char name[100];
  for(x=0;xƒ10;x++) {
     sprintf (name,"%d.dat", x);
	if ( (fp=fopen (name,"wt"))==NULL){
	 fprintf (stderr, "error\n");
	exit(1);
	}
	fprintf (fp,"%07d", x);
	fclose (fp);
	}
	return 0;
}


[o—ΝŒ‹‰Κ]
ƒtƒ@ƒCƒ‹F10ŒΒμ¬ (0.dat, 1.dat, ..., 10.dat)
’†g 0.dat 0000000, 1.dat 0000001

Back to C Language

Google