Hi, i pretend to do a program to put two files in only one, more particularly, a file down of other. I did a routine (below), but the program isn't copying a file down of other and yes copying a file to other. I used SetEndOfFile for to set the pointer to the end of the first file, for after to copy the second file to the first file, but didn't work. I need help. Examples are welcomes. ----------------------------------- ........... .const MAXSIZE equ 260 ........... .data hMapFileSec HANDLE 0 NameSec db MAXSIZE dup(0) ........... .data? hPri HANDLE ? hSec HANDLE ? pMemory DWORD ? bytes_written DWORD ? ........... .code ....... .ELSEIF uMsg == WM_COMMAND .if wParam == IDB_CONCATENATE invoke CreateFile,ADDR NomePri,GENERIC_WRITE,0,NULL,\ OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL mov hPri,eax invoke CreateFile,ADDR NomeSec,GENERIC_READ,0,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL mov hSec,eax invoke CreateFileMapping,hSec,NULL,PAGE_READONLY,0,0,NULL mov hMapFileSec,eax invoke SetEndOfFile,hPri invoke MapViewOfFile,hMapFileSec,FILE_MAP_READ,0,0,0 mov pMemory,eax invoke GetFileSize,hSec,NULL invoke WriteFile,hPri,pMemory,eax,ADDR bytes_written,NULL invoke UnmapViewOfFile,pMemory invoke CloseHandle, invoke CloseHandle,hMapFileSec invoke CloseHandle,hSec invoke MoveFile,NamePri,NameSec ............ ----------------------------------------------------------
Posted on 2001-03-16 12:23:00 by MandaChuva
I can't say that I've ever tried joining the contents of two files, so I may be talking out of my ass here but it wouldn't be the first time eh? 8n) Here's the only thing that comes to mind. Have you tried reading the first file into a buffer and the second file into a second buffer and then concatenating the two...and finally writing them to the file (after they've been joined)? I'm sorry, but I don't have the time to throw an example together. Hope this helps. G'luck --4oh4
Posted on 2001-03-18 22:11:00 by 4oh4
SetEndOfFile does not set the file pointer to the end of the file, if you call it just after opening a file it will truncate it to 0 bytes. Use SetFilePointer instead:

invoke SetFilePointer,hPri,0,0,FILE_END
Posted on 2001-03-19 08:48:00 by Tola