Click to See Complete Forum and Search --> : File


nitya
September 3rd, 2001, 05:29 AM
I need to read a Binary file and store it as text file in specified path

berta
September 3rd, 2001, 05:56 AM
do U known the bynary struct of file?

hi,brt

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

nitya
September 3rd, 2001, 06:00 AM
I dont know the binary struct of the file but the data of one of the fiel looks somewhat like this which i have to read as text and store it in a notepad

Binary file content


4:30:46reddy, rahsa TESCASE 2.504.0532  pÅ@óŒ  XRHT& Z  ¨7Ó!â@ n{ XRHT  ¨7Ó!â@ ôŒ ôŒ ÿÿ  (Dummy Values 10/8/94 10:26) XRHT
 ¨7Ó!â@ õŒ õŒ ´ ÿÿ5 0000301000000-1 Manual Entries XRHT
 ¨7Ó!â@ öŒ öŒ ´ ÿÿ5 0000401000100-1 Dummy Values XRHT ÑHÀ7Ó!â@ SysBP BP ##0 ÿÿÿÿÿÿ 
(    ð?  00000ÿÿ Ã ±! V Ï ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ¶ XRHT  ÑHÀ7Ó!â@  MeanBP (##0) ÿÿ ÿÿ
(    ð?   00001ÿÿ Ã ±! V Ï ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ¶ XRHT  ÑHÀ7Ó!â@  DiaBP ##0 ÿÿÿÿ 
(    ð?   00002ÿÿ Ã ±! V Ï ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ ¶ XRHT 

berta
September 3rd, 2001, 07:15 AM
I don't think U can read a bynary file without its structure.

example

'bynary file: abc@A

'and its struct is

type my_struct
s string*3
b1 byte
b2 byte
end type

dim rec as my_struct

open "myfile" for bynary as #1
get #1,,rec
close #1

open "myfile2" for output as #1
print #1,rec.s & cstr(rec.b1) & cstr(rec.b2)
close #1

'text file: "abc6465"

'in fact "@"=64 in ascii code and "A"=65 in ascii code





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