阅读:2360回复:1
关于VXD下文件复制
关于VXD下文件复制
xinhe很抱歉,这个网页似乎有问题,我回复老出问题, 所以.....。 我觉得你的参数有问题,请看我的: BOOL CopyFile(char *SrcFile,char *DestFile) { DWORD SrcFileHandle,DestFileHandle; BYTE Action; WORD Errors; DWORD ReadCount=0; DWORD FileOffset=0; int code; int bRead1,bRead; int i; char StrBuffer[1024]; int result; int rw=0; Action = ACTION_OPENEXISTING; //0x01; code=R0_OpenCreateFile( FALSE, ACCESS_READWRITE,//0x00 0, Action, R0_NO_CACHE, SrcFile, &SrcFileHandle, &Action); if(SrcFileHandle<=0) { Out_Debug_String("open srcfile wrong\r\n"); return FALSE; } else Out_Debug_String("open srcfile ok\r\n"); Action = ACTION_CREATEALWAYS; //0x12 code=R0_OpenCreateFile( R0_OPENCREATFILE, ACCESS_WRITEONLY, 0, Action, R0_NO_CACHE,DestFile, &DestFileHandle, &Action); if(DestFileHandle<=0) { Out_Debug_String("open dstfile wrong\r\n"); return FALSE; } else Out_Debug_String("open dstfile ok\r\n"); R0_GetFileSize(SrcFileHandle, &bRead1); for(i=0;;i++){ // R0_GetFileSize(SrcFileHandle, &bRead); rw=i*1024; result=R0_ReadFile( FALSE, SrcFileHandle, 1024, rw, StrBuffer, &ReadCount); Out_Debug_String("read is next\n\r"); R0_GetFileSize(DestFileHandle, &bRead); R0_WriteFile( R0_WRITEFILE, DestFileHandle, 1024, bRead, StrBuffer, &bRead); // Out_Debug_String(StrBuffer); Out_Debug_String("write is next\n\r"); memset(StrBuffer,0,1024); if((rw+1024)>bRead1)break; } R0_CloseFile(SrcFileHandle,&Errors); R0_CloseFile(DestFileHandle,&Errors); return TRUE; } |
|
|
沙发#
发布于:2001-04-16 18:46
修改了参数以后,现在已经可以正常复制文件了。如果创建目录还请指点,多谢。
|
|