ÇÁ·Î±×·¡¹Ö

 3198, 1/160 ȸ¿ø°¡ÀÔ  ·Î±×ÀΠ 
   zeros47
   À¯´Ð½º ÆÄÀÏ ºÐÇÒ ÄÚµå Áú¹®ÀÔ´Ï´Ù.

http://www.hackerschool.org/HS_Boards/zboard.php?AllArticle=true&no=3100 [º¹»ç]


#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´ÜÀ§·Î Âɰ³°í ½ÍÀºµ¥¿ä.



Âɰ³ÁöÁö°¡ ¾Ê³×¿ä.



±×¸®°í Âɰ¶ »çÀÌÁîµµ ÀԷ¹ÞÀ¸·Á¸é ¾î¶»°Ô ±¸ÇöÇØ¾ß µÉ±î¿ä?



¿­½ÉÈ÷ ÇØº¸°í Àִµ¥ Àß ¸ð¸£°Ù³×¿ä Á¶¾ð ºÎʵå·Á¿ä~

  Hit : 4682     Date : 2011/07/25 01:45



    
intmain1202 Âɰ¶ ½ÎÀÌÁ ÀԷ¹ÞÀ¸½Ã·Á¸é

./split <ÀԷ¹®ÀÚ¿­> <Âɰ¶ ½ÎÀÌÁî> ÇϽøéµÇ°Ù³×¿©

±×¸®°í argv[1] ¿¡ ¹®ÀÚ¿­ÀÌ ÀÖ±¸¿ä ±×·³ ±×°É Á¤¼öÇüÀ¸·Î ¹Ù²ãÁÖ½Ã¸é µÇ°ÙÁÒ~~
2011/07/26  
zeros47 ´äº¯ °¨»çµå·Á¿ä~ 2011/08/03