Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mix mode input of a binary open file Question!
#3
Nice work, Steve. It depends on the programmer's approach, I realized. While you are providing a way to do it, I was looking for reasons not to do it Smile

It will work via binary access as you write here, but it won't work via Input and a file opened for reading, because some characters control the behavior of the input command in Open for Input mode.

The following program shows how binary text can confuse the Input command when reading a binary file.

Code: (Select All)

For a = 0 To 255
    f$ = Chr$(a) + f$
Next a

ff = FreeFile
Open "binTest" For Binary As ff
Put ff, , f$
Close ff

ff = FreeFile
_ControlChr Off 'not for operations in file, just for printing...
Open "binTest" For Input As ff
Dim b As String
Do Until EOF(ff)
    Input #ff, b$ 'or try LINE INPUT, returned string is not returned in full lenght
    Sleep
    Print b$, Len(b$)
Loop
Close ff


Reply


Messages In This Thread
RE: Mix mode input of a binary open file Question! - by Petr - 11-28-2024, 02:02 PM



Users browsing this thread: 1 Guest(s)