i have this code to write to a binary file.
VB Code:
Private Sub doSave(saveFile As String) Dim NewPos As Long Open saveFile For Binary As #1 Put #1, 1, "[Destination Folder] = " & SaveLoc & Chr(0) NewPos = 1 + Len("[Destination Folder] = " & SaveLoc & Chr(0)) Put #1, NewPos, "[Output Format] = " & SaveType & Chr(0) NewPos = NewPos + Len("[Output Format] = " & SaveType & Chr(0)) Put #1, NewPos, "[Extension Used] = " & SaveExt & Chr(0) NewPos = NewPos + Len("[Extension Used] = " & SaveExt & Chr(0)) Put #1, NewPos, "[Number of Files] = " & LstFiles.ListCount & Chr(0) NewPos = NewPos + Len("[Number of Files] = " & LstFiles.ListCount & Chr(0)) If ChkDelSource.Value = 0 Then Put #1, NewPos, "[Delete Source] = False" & Chr(0) NewPos = NewPos + Len("[Delete Source] = False" & Chr(0)) Else Put #1, NewPos, "[Delete Source] = True" & Chr(0) NewPos = NewPos + Len("[Delete Source] = True" & Chr(0)) End If Put #1, NewPos, "[List of Files] = " & Chr(0) NewPos = NewPos + Len("[List of Files] = " & Chr(0)) For tmpCnt = 0 To LstFiles.ListCount - 1 Put #1, NewPos, LstFiles.List(tmpCnt) & Chr(0) NewPos = NewPos + Len(LstFiles.List(tmpCnt) & Chr(0)) Next tmpCnt Close #1 End Sub
and i read from the file in this way
VB Code:
Open bsFile For Binary As #FF cnt = 1 aCnt = 1 ReDim Preserve tLine(aCnt) As String While Not EOF(1) Get #FF, cnt, SomeChar If SomeChar = 0 Then aCnt = aCnt + 1 ReDim Preserve tLine(aCnt) As String Else tLine(aCnt) = tLine(aCnt) & Chr(SomeChar) End If cnt = cnt + 1 Wend Close #FF
and this is the result i get.
what mistake am i making?
[Destination Folder]
[Output Format]
[Extension Used]
[Number of Files] =
[Delete Source] = Fa
[List of Files]
L
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\add.
M
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\base.
P
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\caption.
N
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\close.
P
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\convert.
T
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\destination.
M
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\file.
M
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\logo.
Q
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\minimize.
O
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\Option.
O
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\output.
M
C:\Documents and Settings\Administrator\My Documents\My Pictures\bc\save.bmp
thanx for u're help.




Reply With Quote