Results 1 to 4 of 4

Thread: File: Binary I/O with different Variable-Types

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    thinBasic MVPs
    Join Date
    Oct 2012
    Location
    Germany
    Age
    55
    Posts
    1,554
    Rep Power
    174

    File: Binary I/O with different Variable-Types

    a question about binary file In/Output - all examples are displaying just the use of strings or even how to read in a whole file.

    I want to read and write different mixed variable types and not just bytes or strings and I'm not sure how to do this:


    Example that I use is some vb6-alike pseudocode and not actual thinBasic. the empty parameter-space in put/get- command signals just to write or read the next available value

    local i as Long
    local myByte(10) as Byte
    local myLong(10) as Long
    local myDouble(10) as Double
    local myString(10) as String

    fNum = GetFreeFileHandle

    Open "C:\myFile.dat" for binary as fNum

    __for i = 1 to 10
    ____put fnum,,myLong(i)
    ____put fnum,,myDouble(i)
    __next i
    __for i = 1 to 10
    ____put fnum,,myByte(i)
    ____put fnum,,myString(i) + CRLF
    __next i

    Close fnum

    and now read those values in again the same way, just using "Get fnum,,myValue" instead of "Put fNum,,myValue". How does that work in tB?
    Could someone please "translate" this example?
    Last edited by ReneMiner; 01-11-2012 at 16:41.
    I think there are missing some Forum-sections as beta-testing and support

Similar Threads

  1. decimal <--> binary
    By danbaron in forum Science
    Replies: 0
    Last Post: 31-05-2011, 07:33
  2. Binary Data
    By Michael Clease in forum thinBasic General
    Replies: 20
    Last Post: 12-06-2008, 09:02
  3. Binary Files
    By Michael Clease in forum thinBasic General
    Replies: 3
    Last Post: 23-05-2007, 14:20
  4. getting info from binary file
    By sandyrepope in forum Console
    Replies: 4
    Last Post: 16-02-2007, 20:32

Members who have read this thread: 1

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •