#include <stdio.h>
#include <stdlib.h>
int main(int argc,char *argv[])
{
FILE *ifp, *ofp;
char outfile[50], *buf;
int rdCnt, fileCnt = 0;
if (argc != 2) exit(-99);
if (!(ifp = fopen("normal.txt","rb")) ) {
printf("Open error\n");
return 0;
}
buf = (char*)malloc( atoi(argv[0]) );
while( (rdCnt = fread(buf,1,1000,ifp))>0 ) {
sprintf(outfile,"TEST_%d.txt",fileCnt++); // outfile name: TEST_0.txt, TEST_1.txt
ofp = fopen(outfile,"wb");
fwrite(buf,1,rdCnt,ofp);
fclose(ofp);
}
fclose(ifp);
}
ÀÌ·±½ÄÀ¸·Î Äڵ带 §´ÙÀ½ ./split <ÀÔ·Â ¹®ÀÚ¿> 1000 ÇÏ¸é ÆÄÀÏÀ» 1000byte´ÜÀ§·Î Âɰ³°í ½ÍÀºµ¥¿ä.
Âɰ³ÁöÁö°¡ ¾Ê³×¿ä.
±×¸®°í Âɰ¶ »çÀÌÁîµµ ÀԷ¹ÞÀ¸·Á¸é ¾î¶»°Ô ±¸ÇöÇØ¾ß µÉ±î¿ä?
¿½ÉÈ÷ ÇØº¸°í Àִµ¥ Àß ¸ð¸£°Ù³×¿ä Á¶¾ð ºÎʵå·Á¿ä~
|