Warning: session_destroy() [function.session-destroy]: Session object destruction failed in /home/httpd/html/board/include/header.php on line 32
적수네 동네 - 1원짜리 팁? [ 게시물 삭제 ]
>> Delete No. 1947 article
No. CRC체크 기능도 추가되었으면 정말 좋겠당...

등록 2001-12-03 23:01:00     조회 5
이름 김규랑    

		역시 RZJOIN은 인터넷에 없었군요..
저도 찾다찾다 못찾았었는데요..
잘 쓰겠습니다.. 다만 CRC체크를 해 주는 기능이 업어서 좀 불안하네요..
기능 추가해주시면 더욱 좋겠습니다..
 : 전에 하이텔에 올렸던 소스입니다. 인터넷에 올라온 동영상 파일들을 보면
: xxx.001, xxx.002 이렇게 이름 붙은 것들이 있죠? rzsplit라는 유틸리티로
: 분할한 것으로 rzjoin 유틸리티로 합칠 수 있습니다.
: 리눅스에서 어떻게 이런 파일을 합쳐볼려구 제가 어찌어찌 만들어 봤습니
: 다. 소스는 허접하지만, 지금까지 문제없이 잘 동작하네요. 어쩌다 윈도우즈
: 에서는 잘 join이 안되는 파일도 이걸로는 잘 합쳐집니다.
: -- 신기하다 --;;
:
: 아래는 소스입니다. 유닉스에서 cc -o rzjoin rzjoin.c 하면 컴팔됩니다.
: 사용법은 rzjoin xxx.001 입니다.
:
: /*
:  * Made by Jung, Doyou(벌레잡이) <doyou89 at kornet.net>
:  * 2001.06.17
:  *
:  * Join the split files by rzsplit.
:  */
:
: #include <stdio.h>
:
: /* The return value of functions */
: #define SUCCESS         1
: #define FAIL            0
:
: /* The maximum header size to be read by RZjoin */
: #define MAX_HEADER_SIZE 100
: #define MAX_BUFFER_SIZE 102400
:
: /* tag */
: #define END_OF_HEADER   0x2F
: #define SPACE           0x20
:
: /*#define DEBUG*/
:
: int RZ_openFile(char *p_sFileName, FILE **fp, char *p_sHeader)
: {
:     int iRet;
:
:     *fp = fopen (p_sFileName, "r");
:     if ( *fp == NULL)
:         return FAIL;
:
:     /* read header from the file */
:     iRet = fread (p_sHeader, MAX_HEADER_SIZE, 1, *fp);
:     if ( iRet == 0) {
:         fclose (*fp);
:         return FAIL;
:     }
:
:     return SUCCESS;
: }
:
: int RZ_openResultFile(char *p_sFileName, FILE **fp)
: {
:     *fp = fopen (p_sFileName, "w");
:     if ( *fp == NULL)
:         return FAIL;
:
:     return SUCCESS;
: }
:
: int RZ_getResultFileName_Size(int *p_iByteRead, char
: *p_sResultFileName, int *p_iResultFileSize, char *p_sHeader)
: {
:     int iByteRead, i;
:     char sFileSize[21];
:
:     iByteRead = 0;
:
: #ifdef DEBUG
:     printf ("Get the output filename.");
: #endif
:     /* read the result file name */
:     while ( *p_sHeader != END_OF_HEADER ) {
:         /* 3 consecutive spaces means end of filename. */
:         if ( *p_sHeader == SPACE &&
:                 *(p_sHeader+1) == SPACE &&
:                 *(p_sHeader+2) == SPACE )
:             break;
:
:         *p_sResultFileName++ = *p_sHeader++;
:         iByteRead++;
:     }
:
: #ifdef DEBUG
:     printf ("put ending mark & skip the spaces.");
: #endif
:
:     /* if there is no filename, it's error. */
:     if ( iByteRead == 0 || *p_sHeader == END_OF_HEADER )
:         return FAIL;
:
:     /* put ending mark */
:     *p_sResultFileName = 0;
: #ifdef DEBUG
:     printf ("The output filename is %s.", p_sResultFileName);
: #endif
:
:     /* skip the spaces */
:     while ( *p_sHeader == SPACE ) {
:         p_sHeader++;
:         iByteRead++;
:     }
:
: #ifdef DEBUG
:     printf ("Get the size of the output file.");
: #endif
:     i = 0;
:     /* read the result file size */
: #ifdef DEBUG
:     printf ("header : %d.", *p_sHeader);
: #endif
:     while ( *p_sHeader != END_OF_HEADER ) {
: #ifdef DEBUG
:     printf ("header : %d.", *p_sHeader);
: #endif
:         sFileSize[i++] = *p_sHeader++;
:         iByteRead++;
:     }
:     sFileSize[i] = 0; /* put ending mark */
:
: #ifdef DEBUG
:     printf ("convert filesize string to integer.");
: #endif
:     /* convert filesize string to integer. */
:     *p_iResultFileSize = atoi(sFileSize);
:     if ( *p_iResultFileSize == 0 ) {
: #ifdef DEBUG
:     printf ("file size is %s.", sFileSize);
: #endif
:         return FAIL;
:     }
:
: #ifdef DEBUG
:     printf ("Get the start point of the result file.");
: #endif
:     /* set the start point of the result file */
:     *p_iByteRead = iByteRead + 1;
:
:     return SUCCESS;
: }
:
: int RZ_getNextFile(char *p_sFileName, FILE **fp)
: {
:     int iLen;
:     char *p_ptr;
:
:     iLen = strlen (p_sFileName);
:     p_ptr =  p_sFileName + iLen - 1;
:
:     if ( *p_ptr < '9' )
:         *p_ptr += 1;
:     else {
:         *p_ptr = '0';
:         if ( *(p_ptr-1) < '9' )
:             *(p_ptr-1) += 1;
:         else {
:             *(p_ptr-1) = '0';
:             if ( *(p_ptr-2) < '9' )
:                 *(p_ptr-2) += 1;
:             else
:                 return FAIL;
:         }
:     }
:
:     *fp = fopen (p_sFileName, "r");
:     if ( *fp == NULL) {
: #ifdef DEBUG
:     printf ("file, %s do not exists.", p_sFileName);
: #endif
:         return FAIL;
:     }
:
:     printf ("Read %s", p_sFileName);
:
:     return SUCCESS;
: }
:
: int RZ_joining(int iByteRead, int iResultFileSize, char *p_sFileName,
: char *p_sResultFileName)
: {
:     char sBuffer[MAX_BUFFER_SIZE+1];
:     int  iRet, iReadSize;
:     int  iTotalWrite;
:     FILE *fp, *fpOut;
:
:     /* open result file to be joined. */
:     if ( !RZ_openResultFile (p_sResultFileName, &fpOut) ) {
:         printf ("Error in opening file, %s.", p_sResultFileName);
:         return FAIL;
:     }
:
:     /* Initialize filename */
:     p_sFileName[strlen(p_sFileName)-1] = '0';
:     RZ_getNextFile (p_sFileName, &fp);
:
:     /* read out the header scope. */
:     fread (sBuffer, iByteRead, 1, fp);
:
:     iTotalWrite = 0;
:     do {
:
:         /* do the file copy */
:         while ( (iReadSize = fread (sBuffer, 1, MAX_BUFFER_SIZE, fp)) !
: = 0 ) {
:             iRet = fwrite (sBuffer, iReadSize, 1, fpOut);
:             iTotalWrite += iReadSize;
:
:             if ( iRet == 0 ) {
:                 printf ("Error in writing the result file.");
:                 return FAIL;
:             }
:         }
:         fclose (fp);
:
:         iRet = RZ_getNextFile (p_sFileName, &fp);
: #ifdef DEBUG
:     printf ("The result of RZ_getNextFile() is %d.", iRet);
: #endif
:
:     } while ( iRet ) ;
:
:     if ( iTotalWrite != iResultFileSize ) {
:         printf ("Differ in file size!!!");
:         printf ("Expected file size : %d, real writing size : %d",
:                 iResultFileSize, iTotalWrite);
:         return FAIL;
:     }
:
:     /*fclose (fp);*/
:     fclose (fpOut);
:
:     return SUCCESS;
: }
:
:
: main(int argv, char *argc<>)
: {
:     char sFileName[256];
:     int  iByteRead;
:     char sResultFileName[256];
:     int  iResultFileSize;
:     char sHeader[MAX_HEADER_SIZE+1];
:     FILE *fp;
:
:     if ( argv < 2 ) {
:         printf ("");
:         printf ("Author : Jung, Doyou(벌레잡이)
: <doyou89 at kornet.net>");
:         printf ("         made at 19 Jun, 2001.");
:         printf ("");
:         printf ("USAGE : rzjoin <file-to-be-joined>");
:         printf ("");
:         exit (0);
:     }
:     strcpy (sFileName, argc[1]);
: #ifdef DEBUG
:     printf ("file, %s will be open.", sFileName);
: #endif
:
:     /* open the source file to be joined. */
:     if ( !RZ_openFile (sFileName, &fp, sHeader) ) {
:         printf ("Error in opening file, %s.", sFileName);
:         exit (1);
:     }
: #ifdef DEBUG
:     printf ("file, %s opened.", sFileName);
: #endif
:
:
:     /* get the result filename and size */
:     if ( !RZ_getResultFileName_Size (&iByteRead, sResultFileName,
: &iResultFileSize, sHeader) ) {
:         printf ("Could not get the result filename and size.");
:         exit (1);
:     }
:
:     fclose (fp);
:
:     printf ("");
:     printf ("result file name : %s",sResultFileName);
:     printf ("result file size : %i",iResultFileSize);
:     printf ("");
:
:     /* start joining */
:     if ( !RZ_joining (iByteRead, iResultFileSize, sFileName,
: sResultFileName) ) {
:         printf ("Error in joining file, %s.", sResultFileName);
:         exit (1);
:     }
:
:     printf ("");
:     printf ("rzjoin complete..");
:
: }
:
: --
: O.O
:  |____
[관리자] 패스워드를 입력 하십시오. 답장이 존재하면 함께 삭제됩니다.[ 목록 | 이전 ]
패스워드:    

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved