Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
65 lines
1.7 KiB
C++
65 lines
1.7 KiB
C++
// SplitFile.cpp : 콘솔 응용 프로그램에 대한 진입점을 정의합니다.
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
|
|
int _tmain(int argc, _TCHAR* argv[])
|
|
{
|
|
if(4 != argc)
|
|
{
|
|
printf("usage : SplitFile 자를파일명 출력파일명 자를개수");
|
|
return -1;
|
|
}
|
|
|
|
FILE* lpDataFile = fopen(argv[1], "rt");
|
|
if(lpDataFile)
|
|
{
|
|
FILE* lpOutFile = fopen(argv[2], "rt");
|
|
if(lpOutFile)
|
|
{
|
|
const int nMaxCut = atoi(argv[3]);
|
|
|
|
const int MAX_FILENAME = 1024;
|
|
char szFileName[MAX_FILENAME];
|
|
|
|
const int MAX_BUFFER = 4096;
|
|
char szData[MAX_BUFFER];
|
|
|
|
while(fgets(szFileName, MAX_FILENAME - 1, lpOutFile))
|
|
{
|
|
szFileName[MAX_FILENAME - 1] = 0;
|
|
char* szFileNameToken = strtok(szFileName, "\r\n");
|
|
|
|
if(0 != szFileNameToken)
|
|
{
|
|
FILE* lpCreateFile = fopen(szFileNameToken, "wt");
|
|
if(0 != lpCreateFile)
|
|
{
|
|
for(int nCount = 0; nCount < nMaxCut; ++nCount)
|
|
{
|
|
if(fgets(szData, MAX_BUFFER - 1, lpDataFile))
|
|
{
|
|
szData[MAX_BUFFER - 1] = 0;
|
|
fputs(szData, lpCreateFile);
|
|
}
|
|
else
|
|
{
|
|
break;
|
|
}
|
|
}
|
|
|
|
fclose(lpCreateFile);
|
|
}
|
|
}
|
|
}
|
|
|
|
fclose(lpOutFile);
|
|
}
|
|
|
|
fclose(lpDataFile);
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|