I am converting a rather large program from Win XP embedded to Linux.
On my Laptop I have 32 bit Linux Mint and of course FB 32 bit installed, and it compiled and ran ok.
On my Industrial Fitlet I have 64 bit Linux & FB installed and there it compiles, but fails when it tries to access msort.c
The code for the sort routine I got from someone on the Forum a long time ago.FreeBASIC Compiler - Version 1.04.0 (10-01-2015), built for linux-x86_64 (64bit)
I know there may be better sort routines but really don't want to modify the program.
Code: Select all
Declare Sub Sort overload (sortArray() As String )
Sub Sort overload (sortArray() As String )
Dim As Long arrayLength = Ubound( sortArray ) - Lbound( sortArray ) + 1
QSort( @sortArray( 0 ), arrayLength, 12, ProcPtr(String_Compare) )
End Sub
Code: Select all
Sub GetFileList
Dim FileNaam As ZString * 17
Dim FileSpec As String
Dim As Long FileCount, FileNbr,SF,Xr
FileSpec = Paths.Root + "/recipes/*.JVP"
FileNaam = Dir(FileSpec, 55 )
FileCount = 0
Do 'Firstly count how many files
FileNaam = Dir( ) 'look for next FileNaam
FileCount += 1 'update number of files found.
Loop While Len(FileNaam) > 0
Dim As String SortArray(FileCount) 'Then Dim array to that lenth
'Now do it again
FileSpec = Paths.Root + "/recipes/*.JVP"
FileNaam = Dir(FileSpec, 55 )
FileArray.Nbr = FileCount
FileCount = 0
If FileArray.Nbr > 0 Then
If FileArray.Nbr < 500 Then
For Xr = 1 To FileArray.Nbr
SortArray(Xr) = FileNaam 'save each FileNaam
FileNaam = Dir( ) 'look for next FileNaam
Next
EndIf
EndIf
Sort (SortArray()) 'now get the names sorted.
'If FileExists(ErrControl.ErrFile) Then
If FileArray.Nbr > 0 Then
If FileArray.Nbr < 500 Then
For Xr = 1 To FileArray.Nbr
FileArray.Name(Xr) = SortArray(Xr)
Next
Endif
EndIf
'EndIf
End Sub
Regards