CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Binary to Text

  1. #1
    Join Date
    Aug 2001
    Posts
    31

    Binary to Text

    I have a Binary file which has to be changed to text and inserted into database


  2. #2

    Re: Binary to Text

    declare a type with teh struct of record of your file...


    type rec_t
    name as string
    age as long
    end type

    private sub LOadTableFromFile()

    dim rec as rec_t
    open "xxx" for bynary as #1
    do while note eof(1)
    get #1,,rec
    'put code of insert into DB
    loop

    close #1
    end sub




    <center>
    <HR width=80%>
    <img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
    </center>

  3. #3

    Re: Binary to Text

    declare a type with the struct of record of your file...


    type rec_t
    name as string
    age as long
    end type

    private sub LOadTableFromFile()

    dim rec as rec_t
    open "xxx" for bynary as #1
    do while note eof(1)
    get #1,,rec
    'put code of insert into DB
    loop

    close #1
    end sub




    <center>
    <HR width=80%>
    <img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
    </center>

  4. #4
    Join Date
    Aug 2001
    Posts
    31

    Re: Binary to Text

    I am not able to translate a binary file to Text File


  5. #5

    Re: Binary to Text


    type rec_t
    name as string
    age as long
    end type

    private sub LOadTableFromFile()

    dim rec as rec_t
    open "xxx" for bynary as #1
    do while note eof(1)
    get #1,,rec
    'put code of insert into DB
    'tHIs is a sample of insert:
    '"INSERT into tabella (name,age) VALUES (" & rec.name & "," & cstr(rec.age) & ")"
    loop

    close #1
    end sub




    U don't traslate file from bynary to text but U read directly file in bynary...

    <center>
    <HR width=80%>
    <img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
    </center>

  6. #6

    Re: Binary to Text


    type rec_t
    name as string
    age as long
    end type

    private sub LOadTableFromFile()

    dim rec as rec_t
    open "xxx" for bynary as #1
    do while note eof(1)
    get #1,,rec
    'put code of insert into DB
    'tHIs is a sample of insert:
    '"INSERT into tabella (name,age) VALUES (" & rec.name & "," & cstr(rec.age) & ")"
    loop

    close #1
    end sub




    U don't traslate file from bynary to text but U read directly file in bynary... I assume that file has a struct well defined... so U can difine its struct with VB type...

    <center>
    <HR width=80%>
    <img src='http://web.tiscali.it/bertaplanet/im...ertaplanet.gif'>
    </center>

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured