|
-
Jan 23rd, 2006, 07:02 AM
#1
Thread Starter
New Member
[RESOLVED] VB to Delphi or Explination
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
Last edited by NoSnipeLimit; Jan 23rd, 2006 at 08:24 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|