var sFile = command(1), iBlockSz = cint(command(2))
print sFile
if iBlockSz <= 0 then iBlockSz = 512*1024 else iBlockSz *= 1024
if instr(sFile,".")=0 orelse open(sFile for binary access read as #1) then
  print "failed to open '"+sFile+"'" : sleep : system
end if

dim as ubyte uBlk(iBlockSz-1)

var iExt = instrrev( sFile , ".")
var sName = left(sFile,iExt-1) + ".", sExt = mid(sFile,iExt)

dim as ulong uRead,iNum=0
do
  get #1,,uBlk(),,uRead  
  open sName & iNum & sExt for binary access write as #2
  put #2,,uBlk(0),uRead : close #2 : iNum += 1
loop until uRead < iBlockSz 

print "Done. splitted in " & iNum & " Blocks of " & iBlockSz/1024 & "kb"
sleep
  