Need byte-splitter utility

From: Tony Duell <ard_at_p850ug1.demon.co.uk>
Date: Tue Apr 1 18:01:37 2003

> On 30-Mar-03 at 12:17 Fred Cisin (XenoSoft) wrote:
>
> >This may sound harsh, but what is your favorite programming language?
> >
> >It would be an excellent exercise for learning some programming.
>
> Yes, it is harsh, and such a statement is of absolutely no use to me
> since there are plenty of other things I have chosen to devote my time
> and energy to.
>
> I am, first and foremost, a hardware hack. I have a ton of respect

So am I. I am much happier with a soldering iron and wirewrap tool than
with a keyboard.

However, I have realised over the years that sometimes I have to write a
program to support my hardware interests. Maybe it's the firmware for a
microcontroller on one of my boards. Maybe it's a file conversion
utility (as here). I don't particularly enjoy doing it, but it has to be
done sometimes.

> In short; I will do it if I have no other way to accomplish my goal.
> However, I will always search for a pre-written alternative (yes, I buy
> stuff from shareware authors) before I think about rolling my own.

For me, it depends on how long it would take. I probably wouldn't
consider writing an OS or a language compiler from scratch. But for
something like this it would probably take me less time to write it than
it would to search for something that might do what I want.

An analogy. You have a well-stocked junk box containing many DB25
connectors, and drums of multi-core cable. Your soldering iron is, as
ever hot. You need a null-modem RS232 cable. The nearest shop that sells
them takes you an hour (each way) to get to.

Do you spend a couple of hours going out to buy one, or do you solder one
up from the contents of the junk box. I know which I'd do. And I don't
particularly enjoy making cables...

Same with programming. If it's going to take about half an hour to write
the program, well, I grab K&R, and start coding...

>
> Fortunately, a number of other list users have offered outstandingly
> helpful pointers (thanks, troops!) As it turns out, it's not an odd-even
> split I need; It's high-byte/low-byte split. I'm still digging, and I

Care to explain what the difference is? As I understand it you have a
file containing bytes like this (say)

L0 H0 L1 H1 L2 H2....

And you want to make 2 files, one containing
L0 L1 L2 ...

And the other containing
H0 H1 H2...

Looks like an odd/even split to me.
 
> find I often learn more along the way than I would if I sat down and
> started coding.

Odd, I find I learn more by solving the problem myself than battling with
some ready-made solution that's not quite right...

-tony
Received on Tue Apr 01 2003 - 18:01:37 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:35:42 BST