Subj : Re: Copy File To : Nick Andre From : Chad Adams Date : Sun Sep 04 2022 22:52:07 Thanks Nick. I actually wrote this program, almost exactly as you did. Yours is a little more complex, but i wrote a copy file program. I needed something to install (copy) a lib I am writing for my BBS programs for shared code. Thanks! On 03 Sep 2022, Nick Andre said the following... NA> On 02 Sep 22 21:22:49, Chad Adams said the following to All: NA> NA> CA> Does anyone know a function that will allow you to copy one file to an NA> CA> location? NA> CA> NA> CA> CopyFile(File, File2); NA> NA> procedure SAFECOPY (fromFile, toFile : string); NA> type bufferType = array [1..64] of char; NA> type bufferTypePtr = ^bufferType; { Use the heap } NA> var bufferPtr : bufferTypePtr; { for the buffer } NA> f1, f2 : file; NA> bufferSize, readCount, writeCount : word; NA> fmSave : byte; { To store the filemode } NA> begin NA> bufferSize := SizeOf(bufferType); NA> New (bufferPtr); { Create the buffer, on the heap } NA> fmSave := FileMode; { Store the filemode } NA> FileMode := 0; { To read also read-only files } NA> Assign (f1, fromFile); NA> {$I-} Reset (f1, 1); { Note the record size 1, important! } NA> if IOResult <> 0 then exit; { Does the file exist? } NA> Assign (f2, toFile); NA> {$I-} Rewrite (f2, 1); { Open the target } NA> if IOResult <> 0 then exit; NA> repeat { Do the copying } NA> BlockRead (f1, bufferPtr^, bufferSize, readCount); NA> {$I-} BlockWrite (f2, bufferPtr^, readCount, writeCount); NA> if IOResult <> 0 then begin close (f1); exit; end; NA> until (readCount = 0) or (writeCount <> readCount); NA> close (f1); close (f2); NA> FileMode := fmSave; { Restore the original filemode } NA> Dispose (bufferPtr); { Release the buffer from the heap } NA> end; (* safecopy *) NA> NA> Nick NA> NA> --- Renegade vY2Ka2 NA> * Origin: Joey, do you like movies about gladiators? (1:229/426) --Nugax The ByteXchange BBS TBX Software --- Mystic BBS v1.12 A48 2022/07/15 (Linux/64) * Origin: The ByteXchange BBS | bbs.thebytexchange.com (1:19/37) .