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

Possibly Related Threads…
Thread Author Replies Views Last Post
  a question about OpenGL in QB64pe: TempodiBasic 11 1,835 11-22-2025, 05:47 PM
Last Post: TempodiBasic
  How do you boot Win 11 in Safe Mode? Pete 8 5,876 10-30-2025, 06:03 AM
Last Post: SMcNeill
  Download the file from the internet and extract the .zip file quickbasic 6 672 10-25-2025, 01:39 AM
Last Post: madscijr
  Question about load pictures Jim_001 4 531 10-22-2025, 06:19 AM
Last Post: Unseen Machine
  Test to post a new Thread + question 32 or 64 bit Rudy M 2 548 09-09-2025, 04:10 PM
Last Post: Rudy M

Forum Jump:


Users browsing this thread: