Remote File Engine (.bmx)

Community Forums/Showcase/Remote File Engine (.bmx)

Andres(Posted 2007) [#1]
This is the first thing i've ever done on BlitzMax. I've coded the same engine for B+ too and now I've done it for BlitzMax.

An easy way to read online/remote files. Supports FTP and HTTP protocols.

Functions:
file:TRemoteFile = OpenRemoteFile:TRemoteFile(url:String, port:Int = 80, HTTPpostdata/FTPusername, HTTPheader/FTPpassword)
RemoteReadAvail:Int(file:TRemoteFile)
ReadRemoteLine:String(file:TRemoteFile)
ReadRemoteString:String(file:TRemoteFile, length:Int)
ReadRemoteByte:Byte(file:TRemoteFile)
ReadRemoteInt:Int(file:TRemoteFile)
ReadRemoteLong:Long(file:TRemoteFile)
ReadRemoteDouble:Double(file:TRemoteFile)
ReadRemoteFloat:Float(file:TRemoteFile)
ReadRemoteShort:Short(file:TRemoteFile)
RemoteFileError:String(file:TRemoteFile) ' = "" if there was no error
RemoteFileName:String(file:TRemoteFile) ' sometimes the URL doesn't contain the name of the file and it's specified in HTTP header
RemoteFileSize:Int(file:TRemoteFile) ' -1 if there was no size sent by server
EORF(file:TRemoteFile) ' End Of Remote File
CloseRemoteFile(file:TRemoteFile)


Example:


Engine: