This example is downloading a *SAVF file into a local directory, from MY_LIB/SAVF to c:\temp\mysavf.savf.
nHdl, cnt is int
buf is Buffer
nLocalFile is int
nHdl = ASfOpen("/QSYS.LIB/MY_LIB.LIB/MYSAVF.FILE", ASfoBinary)
IF nHdl = -1 THEN
Error(ErrorInfo())
RETURN
END
nLocalFile = fOpen("c:\temp\mysavf.savf",foWrite+foCreate)
IF nLocalFile = -1 THEN
Error(ErrorInfo())
RETURN
END
cnt = ASfRead(nHdl, 65000, buf)
WHILE cnt<>0
fWrite(nLocalFile, buf, cnt)
cnt = ASfRead(nHdl, 65000, buf)
END
fClose(nLocalFile)
ASfClose(nHdl)
See example.