home *** CD-ROM | disk | FTP | other *** search
- '─ Area: F-QUICKBASIC ─────────────────────────────────────────────────────────
- ' Msg#: 386 Date: 12 Apr 94 15:46:00
- ' From: Blair Colbey Read: Yes Replied: No
- ' To: Mark Pruitt Mark:
- ' Subj: Re: High Speed Qb
- '──────────────────────────────────────────────────────────────────────────────
- 'MP>I'd be really interested in seeing the "copy files with no shelling" and
- 'MP>"file exist" things if you could be convinced to dig 'em out and post
- 'MP>'em.
-
- DECLARE FUNCTION CopyFile% (Source$, Dest$)
- '*************************************************************************
- DIM regs AS RegType
-
- SFileNum = FREEFILE
- OPEN Source$ FOR BINARY AS #SFileNum
-
- DFileNum = FREEFILE
- OPEN Dest$ FOR BINARY AS #DFileNum
-
- DO
- Buffer$ = INPUT$(Block, #SFileNum)
- PUT #DFileNum, , Buffer$
- LOOP UNTIL EOF(SFileNum)
-
- regs.ax = &H5700
- regs.bx = FILEATTR(SFileNum, 2)
- INTERRUPT &H21, regs, regs
-
- IF (regs.flags AND 1) THEN
- CLOSE #SFileNum, #DFileNum
- KILL Dest$
- CopyFile% = 3
- EXIT FUNCTION
- END IF
-
- regs.ax = &H5701
- regs.bx = FILEATTR(DFileNum, 2)
- INTERRUPT &H21, regs, regs
-
- IF (regs.flags AND 1) THEN
- CLOSE #SFileNum, #DFileNum
- KILL Dest$
- CopyFile% = 3
- EXIT FUNCTION
- END IF
-
- CLOSE #SFileNum, #DFileNum
- CopyFile% = 0
- END FUNCTION
-
- 'Now here is what you use to call it! Note! Be sure to use a file exist
- 'to make sure the files are there before you try to copy them.
-
- 'Here is is
- CONST Block = 4096 'leave it at this size no bigger
- Dumb = CopyFile("C:\AUTOEXEC.BAT", "C:\TEMP\ZZ.TXT")
- 'That's it you can rename the file as you copy of you want. i like this
- 'routine since you don't have to shell to dos!.
-