I Need to make this work but unable to find a solution with AGK
This code is working fine under regular basic compiler
Any advice would be welcome
Function ConvertIP(Action as Integer,Buffer as String)
Local IPvalue as Integer [4]
If Action=1 // Convert IP from V4 to Numerical
Counter1=1
repeat
Position=FindString(Buffer,".")
If Position > 0
IPvalue[Counter1]=Val(Mid(Buffer,1,Position-1))
Buffer=Mid(Buffer,Position+1,-1)
Inc Counter1, 1
Else
IPvalue[Counter1]=Val(Buffer)
EndIf
Until Position = 0
Response$ = Str( ( IPvalue[1]*(256^3) ) + ( IPvalue[2]*(256^2) ) + ( IPvalue[3]*(256) ) + IPvalue[4] )
Else
IPNUM=VAL(Buffer)
// Print ( Str( IPNum ) )
// Print ( Str( 256^3 ) )
// Print ( Str( IPNUM /(256^3) ) )
// Print ( Str( IPNUM /(256^3) And 255 ) )
// Print ( Str( Trunc( IPNUM / (256^3) ) And 255 ) )
// Sync()
// Sleep(2000)
IPvalue[1] = Trunc( IPNUM / (256^3) ) And 255
IPvalue[2] = Trunc( IPNUM / (256^2) ) And 255
IPvalue[3] = Trunc( IPNUM / 256 ) And 255
IPvalue[4] = IPNUM - ((IPvalue[1]*(256^3))+(IPvalue[2]*(256^2))+(IPvalue[3]*(256)))
Response$ = Str(IPvalue[1])+"."+Str(IPvalue[2])+"."+Str(IPvalue[3])+"."+Str(IPvalue[4])
EndIf
endfunction Response$
Do
Print ( ConvertIP(1,"70.83.142.27") )
Print ( ConvertIP(2,"1179880987") )
Sync()
Loop