Got an idea for enhancing SpiderBasic? New command(s) you'd like to see?
IdeasVacuum
 
Posts: 134
Joined: Tue Feb 25, 2014 1:27 pm

CopyFile()

by IdeasVacuum Thu Sep 14, 2017 11:02 pm

Before Overwriting an existing file, it is good practice to make a copy of it (backup), so a CopyFile() function would be great......

Work-around is to read existing file-write backup file, roughly this:
Code: Select all
Procedure.i PfCopyFile(sFile1.s, sFile2.s)
;#----------------------------------------
Protected iFormat.i

              If ReadFile(1, sFile1)

                     If(Lof(1) > 1)

                            If CreateFile(2, sFile2)

                                   iFormat = ReadStringFormat(1)
                                   
                                   While Eof(1) = 0
                                   
                                           WriteStringN(2, ReadString(1, iFormat), iFormat)
                                   Wend
                                   
                                         CloseFile(2)
                                   ProcedureReturn(#True)
                            EndIf
                     EndIf

                     CloseFile(1)
              Else
                     ProcedureReturn(#False)
              EndIf
EndProcedure
Return to Feature Requests and Wishlists

Who is online

Users browsing this forum: No registered users and 1 guest