Compare Sources Codes - Matching Code ? This code includes a function to compare a pair of source files to each other. The function returns if the two functions are the same or not.
Usage demo[pbcode]
// Run in DEBUG (F7) and view the console window
// to see output
loadfont "arial narrow",1, 36
Path$ ="Examples/"
File1$ =Path$+"test-code1.pba"
File2$ =Path$+"test-code2.pba"
Message(File1$,File2$)
Sync
WaitKEY
Function Message(File1$,File2$)
c1=$334455
c2=$776633
th=getTextHeight("|")/2
ypos=getcursory()
ypos2=ypos+th
shadebox 0,ypos,getsurfacewidth(),ypos2,c1,c2,c1,c2
setcursor 0,ypos2
print "Comparing Source Files"
print "File [1] ="+file1$
print "File [2] ="+file2$
result=COMPARE_SOURCE_FILES(file1$,file2$)
print "Compare Result #"+str$(result)
print ""
EndFunction
; ---------------------------------------------------------------------------------------
; ---------------------------------------------------------------------------------------
; ---------------------------------------------------------------------------------------
Function LoadFileToString(file$)
if FIleexist(file$)
local size=filesize(file$)
local f=readnewfile(file$)
result$=readchr$(f,size)
closefile f
endif
EndFunction Result$
[/pbcode]
Related Links: - Function Finder (https://www.underwaredesign.com/forums/index.php?topic=4782.0)
- PlayBASIC Home Page (https://playbasic.com)
Download Sources Code Attached bellow