filecopySample
// filecopySample.cpp
#using <mscorlib.dll>
#using <System.dll>
using namespace System;
using namespace System::IO;
int main(array<System::String ^> ^args)
{
FileStream inputStream(args[0], FileMode::Open);
FileStream outputStream(args[1], FileMode::Create);
for(;;)
{
array<Byte> ^ ar = gcnew array<Byte>(1024);
int size = inputStream.Read(ar, 0, ar->Length);
if ( size == 0 ) break;
outputStream.Write(ar, 0, size);
}
return 0;
}
cat makefile
TARGET=filecopySample
all: $(TARGET).exe
.PHONY: all test mmm clean html
.SUFFIXES: .obj
#LOPT=-ENTRY:main -SUBSYSTEM:WINDOWS
LOPT=
OBJS=$(TARGET).obj
$(TARGET).obj: $(TARGET).cpp
$(TARGET).exe: $(OBJS)
link $(LOPT) $(OBJS)
.cpp.obj:
cl -c -Wall -Od -clr $<
test:
./$(TARGET).exe makefile makefile.cpy
clean:
-rm $(TARGET).exe *.obj *~
mmm:
cat $(TARGET).cpp
@echo
cat makefile
html:
cat /dev/clipboard | code2html.exe | unix2dos