a$ to binary

Helo,
I read an ASCII file as follows:
OPEN "test" FOR INPUT AS #1
LINE INPUT #1, a$

a$ are numbers in the range of -150 to 255 and one number is in one line

Now I want save it into binary file for later acces with GET statement

Howto do this in QB45 language?
Peja

Comments

  • : Helo,
    : I read an ASCII file as follows:
    : OPEN "test" FOR INPUT AS #1
    : LINE INPUT #1, a$
    :
    : a$ are numbers in the range of -150 to 255 and one number is in one line
    :
    : Now I want save it into binary file for later acces with GET statement
    :
    : Howto do this in QB45 language?
    : Peja
    :
    There is a really easy way to do it.
    It could look something like this:

    [code]
    OPEN "test" FOR INPUT AS #1
    OPEN "test2" FOR BINARY AS #2
    WHILE NOT EOF(1)
    LINE INPUT #1, a$
    b = CannotRemmemberTheNameOfTheFunc(a$)
    put #2,b
    WEND
    [/code]
  • [b][red]This message was edited by DrMarten at 2006-4-4 17:43:58[/red][/b][hr]
    : : Helo,
    : : I read an ASCII file as follows:
    : : OPEN "test" FOR INPUT AS #1
    : : LINE INPUT #1, a$
    : :
    : : a$ are numbers in the range of -150 to 255 and one number is in one line
    : :
    : : Now I want save it into binary file for later acces with GET statement
    : :
    : : Howto do this in QB45 language?
    : : Peja
    : :
    : There is a really easy way to do it.
    : It could look something like this:
    :
    [code]
    OPEN "test" FOR INPUT AS #1
    OPEN "test2" FOR BINARY AS #2
    WHILE NOT EOF(1)
    LINE INPUT #1, a$
    b = CannotRemmemberTheNameOfTheFunc(a$)
    put #2,b
    WEND
    CLOSE #1
    CLOSE #2
    [/code]
    ==========================================

    In the above code insert
    [code]
    b=VAL(A$)
    [/code]
    instead of the line>>
    [code]
    b = CannotRemmemberTheNameOfTheFunc(a$)
    [/code]

    I believe this is what you want as VAL converts a string into a VALue, as far as i remember. :-)


    Regards,

    Dr M.



Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion