For Programmers: Free Programming Magazines  


Home > Archive > Tcl > December 2006 > How can I write string to binary file?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How can I write string to binary file?
Evan

2006-12-19, 7:14 pm

Hi, guys

I have some data info (in hex dump ASCII fromat)like below:


73 00 00 00 5f a6 8a 5b 43 1f 34 99 3b 77 85 ff
0d 3d 96 8a 66 a5 17 bc b1 93 2e f0 40 44 23 89

I want to write them to a binary file, does anyone give me some tips on
this problem?

Thanks very mush.
Evan

Volker Hetzer

2006-12-19, 7:14 pm

Evan schrieb:
> Hi, guys
>
> I have some data info (in hex dump ASCII fromat)like below:
>
>
> 73 00 00 00 5f a6 8a 5b 43 1f 34 99 3b 77 85 ff
> 0d 3d 96 8a 66 a5 17 bc b1 93 2e f0 40 44 23 89
>
> I want to write them to a binary file, does anyone give me some tips on
> this problem?
>
> Thanks very mush.

look up the commands "binary" (for formatting) and "fconfigure" (for putting
it into a file).

Lots of Greetings!
Volker
--
For email replies, please substitute the obvious.
Darren New

2006-12-19, 7:14 pm

Evan wrote:
> I want to write them to a binary file, does anyone give me some tips on
> this problem?


Tip: the [binary] command (and I never remember without looking whether
it's [binary scan] or [binary format]), and the [encoding convertto]
command (or [fconfigure -encoding]).

Hopefully you only wanted tips, and not complete solutions. ;-)

--
Darren New / San Diego, CA, USA (PST)
Scruffitarianism - Where T-shirt, jeans,
and a three-day beard are "Sunday Best."
Ralf Fassel

2006-12-19, 7:14 pm

* Darren New <dnew@san.rr.com>
| (and I never remember without looking whether it's [binary scan] or
| [binary format]),

binary scan: you have binary and want text
binary format: you have text and want binary

R'
Evan

2006-12-19, 10:09 pm


"Ralf Fassel =D0=B4=B5=C0=A3=BA
"
> * Darren New <dnew@san.rr.com>
> | (and I never remember without looking whether it's [binary scan] or
> | [binary format]),
>
> binary scan: you have binary and want text
> binary format: you have text and want binary
>=20
> R'


That's great.

Thanks all.=20
I will try to do a test.

Evan

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com