Click to See Complete Forum and Search --> : Binary to Text


nitya
August 31st, 2001, 03:33 AM
I have a Binary file which has to be changed to text and inserted into database

berta
August 31st, 2001, 03:37 AM
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/images/bertaplanet.gif'>
</center>

berta
August 31st, 2001, 03:39 AM
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/images/bertaplanet.gif'>
</center>

nitya
August 31st, 2001, 08:36 AM
I am not able to translate a binary file to Text File

berta
August 31st, 2001, 08:41 AM
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/images/bertaplanet.gif'>
</center>

berta
August 31st, 2001, 08:43 AM
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/images/bertaplanet.gif'>
</center>