Concatenating binary files?

Ned Konz ned at bike-nomad.com
Mon Mar 31 23:01:29 UTC 2003


On Monday 31 March 2003 02:51 pm, Jimmie Houchin wrote:

> I failed to edit the email end of of lines on the fileDir. So I
> guess this cause the StandardFileStream to fail initialization?

Yes, you probably don't have a directory with a CR in the middle of 
its name.

In production code you should check for whether opens succeeded or 
not. Using Tim's code:

fileDir := FileDirectory default directoryNamed:'C:\Documents and
 Settings\Jimmie\My
Documents\My Music\MP3\Alexander Scourby\waves'.
fileDir exists ifFalse: [ ... do something ... ].
wave3 := fileDir fileNamed: 'Genesis 37k.wav'.   "Will create/clobber 
a file"
wave2 := fileDir oldFileNamed: 'Genesis 37b.wav'.  "Will pop up a 
requester"
wave1 := fileDir oldFileNamed: 'Genesis 37a.wav'. "Will pop up a 
requester"

> Nevertheless, when I corrected it your code worked with the
> exception of the MNU: close on 'wave2'. According to the debugger
> it was a 'aByteArray'. I imagine I can remove the close messages
> for wave1 and wave2.

Yes, you're right. I was working too fast.

> >> My skills with the debugger are non-existent.
> >
> > Tim's suggestions are very good, especially if you don't want to
> > read the entire file into memory.
> >
> > But you really should learn to use the debugger; it'll save you
> > lots of time. You can even fix a method and continue your program
> > in many cases.
>
> I always click on 'debug' sometimes I do learn why my code fails.
> Sometimes I just learn I don't know very much. :)
>
> I regularly learn I didn't place a '.' at the end of a statement.

At least you don't have to worry about indentation!

> > If you just pop up the debugger, it'll show you the call stack.
> > You can click on the various stack frames (the topmost list) and
> > see where you are in each method.
> >
> > You can also examine variables.
> >
> > So in this case it would be good to find out what didn't
> > understand #binary.
>
> When I am the debugger window for this code it shows the 'wave...'
> variables to be 'nil'. I guess this goes back to a failed
> initialization I spoke of above.

If you're in the code prior to the assignment to the wave* variables, 
they will be nil.

-- 
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE



More information about the Squeak-dev mailing list