06-16-2025, 12:17 AM
(This post was last modified: 06-16-2025, 12:23 AM by Dale Yarker.)
'Question is in PowerBASIC for Windows section, so changed Albert's code
'to PBWin from PBCC.
'
'I was curious if FileA is itself the running EXE containing FILECOPY.
'But that works fine also. (see #COMPILE line)
'
'that leaves CHDR "D:\Test_with_Files"
'1. is the program that is doing the FILECOPY in D:\Test_with_Files ?
'2. if FileA is not in D:\Test_with_Files it will not be found by FILECOPY.
'
'code in post 1 had no error checking and PB does not display "messages"
'unless asked.
'
'Cheers,
'to PBWin from PBCC.
'
'I was curious if FileA is itself the running EXE containing FILECOPY.
'But that works fine also. (see #COMPILE line)
'
Code:
#compile exe "test.exe"
#dim all
'
function pbmain () as long
local sFileA as string
local sFileB as string
sFileA = "test.exe" ' This running program
sFileB = "copy_of_test.exe"
filecopy sFileA,sFileB
if err then
'stderr str$(err)+": "+error$(err)
? str$(err)+": "+error$(err)
end if
if isfile(sFileB)=0 then
'stderr "Filecopy did not succeed."
? "Filecopy did not succeed."
end if
? "done"
end function '
'1. is the program that is doing the FILECOPY in D:\Test_with_Files ?
'2. if FileA is not in D:\Test_with_Files it will not be found by FILECOPY.
'
'code in post 1 had no error checking and PB does not display "messages"
'unless asked.
'
'Cheers,