Dave Roberts suggested a Profile of a program I'm working on. It's a nifty tool, and really easy to use. Here's a simple function to Alpha the results for easier reading.
Better Code found here: http://www.powerbasic.com/support/pb...ad.php?t=39112
Code:
Function Profile_Alpha(Profile_FileName As String) As Long Local ctr, fnum As Long Local lns(), s As String retry: Try 'Wait until file is ready to be opened Open Profile_FileName For Binary As #fnum Catch Sleep 100 GoTo retry End Try ctr = Lof(#fnum) 'how big s$ = Space$(ctr) 'create big string to get file Get #fnum, 1, s$ 'now get the file Close 'don't need it any more ctr = ParseCount(s$, $CrLf) 'How many lines Dim lns$(ctr) 'create array Parse s$, Lns$(), $CrLf 'Fill array Array Sort Lns$() 'Sort it Open Profile_FileName For Output As #fnum 'Re open to put sorted list For ctr = LBound(Lns$()) To UBound(Lns$()) Print #fnum, lns$(ctr) 'put the line Next ctr Close ' Reset s$ ' testing maybe ' For ctr = Lbound(lns$()) To Lbound(lns$()) + 10 ' s$ = s$ & lns(ctr) & $CrLf ' Next ctr ' ?s$ End Function ' 'At the end of PBMain put this: ' Profile "c:\Program_Name.txt" 'Profile created here. Call it anything you want ' Profile_Alpha("c:\Program_Name.txt") ' Applikation beenden
Comment