Initial
This commit is contained in:
BIN
parts/Debug/parts.exe
Normal file
BIN
parts/Debug/parts.exe
Normal file
Binary file not shown.
BIN
parts/Debug/vc60.idb
Normal file
BIN
parts/Debug/vc60.idb
Normal file
Binary file not shown.
116
parts/main.cpp
Normal file
116
parts/main.cpp
Normal file
@@ -0,0 +1,116 @@
|
||||
#include <common/windows.hpp>
|
||||
#include <common/array.hpp>
|
||||
#include <common/string.hpp>
|
||||
#include <common/winsvc.hpp>
|
||||
#include <common/file.hpp>
|
||||
|
||||
#define MAX_BYTES 64000000
|
||||
#define BUF_SIZE 1024000
|
||||
|
||||
void combine();
|
||||
void divide(const String &pathFileName);
|
||||
|
||||
void main(int argc,char ** argv)
|
||||
{
|
||||
String command;
|
||||
|
||||
if(argc<2)
|
||||
{
|
||||
::printf("USAGE parts {divide[filename]|combine} {filename} ** if combine then filename \n");
|
||||
return;
|
||||
}
|
||||
command=argv[1];
|
||||
|
||||
if(command=="divide")
|
||||
{
|
||||
if(argc!=3)
|
||||
{
|
||||
::printf("USAGE parts {divide[filename]|combine} {filename} ** if combine then filename \n");
|
||||
return;
|
||||
}
|
||||
divide(argv[2]);
|
||||
}
|
||||
else if(command=="combine")combine();
|
||||
else ::printf("unknown command\n");
|
||||
}
|
||||
|
||||
void combine()
|
||||
{
|
||||
Array<BYTE> bytes;
|
||||
File inFile;
|
||||
File outFile;
|
||||
DWORD part=0;
|
||||
DWORD readCount=0;
|
||||
String strPathFileName;
|
||||
|
||||
if(!outFile.open("result.dat","wb"))
|
||||
{
|
||||
::printf("unable to open output 'result.dat'\n");
|
||||
return;
|
||||
}
|
||||
bytes.size(BUF_SIZE);
|
||||
while(true)
|
||||
{
|
||||
::sprintf(strPathFileName,"part_%d.dat",part);
|
||||
if(!inFile.open(strPathFileName,"rb"))
|
||||
{
|
||||
::printf("unable to open %s\n",strPathFileName.str());
|
||||
return;
|
||||
}
|
||||
::printf("Reading %s\n",strPathFileName.str());
|
||||
while(0!=(readCount=inFile.read((char*)&bytes[0],bytes.size())))
|
||||
outFile.write((char*)&bytes[0],readCount);
|
||||
inFile.close();
|
||||
part++;
|
||||
}
|
||||
}
|
||||
|
||||
void divide(const String &strPathInput)
|
||||
{
|
||||
Array<BYTE> bytes;
|
||||
DWORD part=0;
|
||||
DWORD count=0;
|
||||
DWORD byteCount=0;
|
||||
DWORD totalCount=0;
|
||||
String strPathFileName;
|
||||
File inFile;
|
||||
File outFile;
|
||||
|
||||
bytes.size(BUF_SIZE);
|
||||
if(!inFile.open(strPathInput,"rb"))
|
||||
{
|
||||
::printf("Cannot open input\n");
|
||||
return;
|
||||
}
|
||||
::sprintf(strPathFileName,"part_%d.dat",part);
|
||||
if(!outFile.open(strPathFileName,"wb"))
|
||||
{
|
||||
::printf("cannot open output '%s'\n",strPathFileName.str());
|
||||
return;
|
||||
}
|
||||
while(true)
|
||||
{
|
||||
if(count>MAX_BYTES)
|
||||
{
|
||||
outFile.close();
|
||||
part++;
|
||||
::sprintf(strPathFileName,"writing 'part_%d.dat'",part);
|
||||
if(!outFile.open(strPathFileName,"wb"))
|
||||
{
|
||||
::printf("cannot open output '%s'\n",strPathFileName.str());
|
||||
return;
|
||||
}
|
||||
count=0;
|
||||
}
|
||||
byteCount=inFile.read((char*)&bytes[0],bytes.size());
|
||||
if(!byteCount)break;
|
||||
if(!outFile.write(&bytes[0],byteCount))
|
||||
{
|
||||
::printf("Unable to write to '%s'\n",strPathFileName.str());
|
||||
return;
|
||||
}
|
||||
count+=byteCount;
|
||||
totalCount+=byteCount;
|
||||
// if(!(totalCount%BUF_SIZE))::printf("Wrote %d bytes to %s\n",totalCount,strPathFileName.str());
|
||||
}
|
||||
}
|
||||
116
parts/parts.dsp
Normal file
116
parts/parts.dsp
Normal file
@@ -0,0 +1,116 @@
|
||||
# Microsoft Developer Studio Project File - Name="parts" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=parts - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "parts.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "parts.mak" CFG="parts - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "parts - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "parts - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "parts - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "parts - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /D "__FLAT__" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /pdbtype:sept
|
||||
# SUBTRACT LINK32 /pdb:none /debug
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "parts - Win32 Release"
|
||||
# Name "parts - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\main.cpp
|
||||
|
||||
!IF "$(CFG)" == "parts - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "parts - Win32 Debug"
|
||||
|
||||
# ADD CPP /W1 /D "STRICT" /D "__FLAT__"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
44
parts/parts.dsw
Normal file
44
parts/parts.dsw
Normal file
@@ -0,0 +1,44 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "common"=..\common\common.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "parts"=.\parts.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name common
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
BIN
parts/parts.opt
Normal file
BIN
parts/parts.opt
Normal file
Binary file not shown.
33
parts/parts.plg
Normal file
33
parts/parts.plg
Normal file
@@ -0,0 +1,33 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: parts - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
Creating temporary file "C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSP59.tmp" with contents
|
||||
[
|
||||
/nologo /MT /W1 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "STRICT" /D "__FLAT__" /Fp"Debug/parts.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /c
|
||||
"D:\work\parts\main.cpp"
|
||||
]
|
||||
Creating command line "cl.exe @C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSP59.tmp"
|
||||
Creating temporary file "C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSP5A.tmp" with contents
|
||||
[
|
||||
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/parts.pdb" /machine:I386 /out:"Debug/parts.exe" /pdbtype:sept
|
||||
.\Debug\main.obj
|
||||
\work\exe\mscommon.lib
|
||||
]
|
||||
Creating command line "link.exe @C:\WINNT\Profiles\sean\LOCALS~1\Temp\RSP5A.tmp"
|
||||
<h3>Output Window</h3>
|
||||
Compiling...
|
||||
main.cpp
|
||||
Linking...
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
parts.exe - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user