CopyFile.cpp
资源名称:IceSword.rar [点击查看]
上传用户:fjdqny
上传日期:2008-02-11
资源大小:921k
文件大小:1k
源码类别:
其他
开发平台:
Visual C++
- #include <windows.h>
- #include <stdio.h>
- #include "Cooperator.h"
- int main(int argc, char *argv[])
- {
- if (argc < 3)
- {
- return -1;
- }
- printf("IsConnectServern");
- if (!IsConnectServer())
- {
- printf("ConnectAndCalln");
- ConnectAndCall();
- }
- if (!IsConnectServer())
- {
- printf("Error to connect servern");
- return -1;
- }
- DWORD ret;
- IsdGetVersion(&ret);
- printf("Icesword version : %xn", ret);
- HANDLE hFile1 = IsdCreateFile(argv[1], 0, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
- HANDLE hFile2 = IsdCreateFile(argv[2], 0, FILE_SHARE_READ, 0, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
- LARGE_INTEGER FileSize;
- if (hFile1 != INVALID_HANDLE_VALUE &&
- hFile2 != INVALID_HANDLE_VALUE)
- {
- if (IsdGetFileSizeEx(hFile1, &FileSize))
- {
- char *buf = (char *)malloc(FileSize.LowPart);
- IsdReadFile(hFile1, buf, FileSize.LowPart, &ret, 0);
- IsdWriteFile(hFile2, buf, FileSize.LowPart, &ret, 0);
- free(buf);
- }
- }
- if (hFile1 != INVALID_HANDLE_VALUE)
- IsdCloseHandle(hFile1);
- if (hFile2 != INVALID_HANDLE_VALUE)
- IsdCloseHandle(hFile2);
- return 0;
- }