VB to Delphi or Explination
0 answers - 1135 bytes -

Hi, i was buzy putting a bit of code into delphi and came along this function. I'm not totally sure what the open or put does. And i cant seem to find the delphi equalevant.
Function WriteBinFile(ByVal bfilename As String, vtData As Variant)
Dim FileNum As Long
Dim binbyte() As Byte
On Error GoTo errHandler
binbyte = vtdata
FileNum = FreeFile
Open bfilename for Binary Access Write As #FileNum
Put #FileNum, , binbyte
Close #FileNum
Exit Function
errHandler:
Exit Function
End Function
So far i made it into this:
Function writeBinFile(bfilename: String; vtdata :Variant):TStream;
Var
FileNum : Integer;
binbyte : Byte;
begin
binbyte := vtData;
FreeAndNil(FileNum);
Open bfilename For Binary Access Write As FileNum;
Put #FileNum, , binbyte;
Close #FileNum;
end;
I've no idea what open/put/close/#/FreeFile is.
Any input will be appreciated.
Thanks
Anton
Ok fixed this using Stream.size/stream.write/stream.position
:D