Concatenation blues

Ben Rubinstein benr_mc at cogapp.com
Fri May 31 06:21:02 EDT 2002


on 30/5/02 10:10 PM, Howard Bornstein at bornstein at designeq.com wrote:

> Ok, now I'm really confused. I took a small 1k jpeg image and read it in
> and wrote it back out using each method (OPEN/READ/WRITE) and (Get/Put
> URL). They came out exactly the same file size. I put the contents of
> them into two variables and compared them (var1 = var 2). The answer was
> true. I did a character by character comparison. They came out identical.
> However, when I view them, the one created with the read/write commands
> has garbage in the image.
> 

In the code you posted originally:
> open file "FinalOutput"

you didn't specify the mode (text/binary) for the output file (you did for
the input files).   Open defaults to text; so if that is really what you
have in your code (not just something you forgot when you typed into the
mail client to post it) this could account for the garbage result.

I can't account for the relative slowness of using the URL version - if
anything I would have expected this to be fractionally quicker.

I also can't account for the difference in size you reported
> The file went from 20,886 bytes down to 12,736 bytes.

Were the source and destination files on different volumes?  And which OS
are you operating on?  It's possible that if they are on different volumes,
the blocking factor makes them take different amounts of space - on MacOS 9,
this would show up as different values in the "...on disk" part, but the
same values in the "(.... bytes)" part of the 'GetInfo' information.  Maybe
some OS's always report the block size, but do it byte accurate - doesn't
sound very likely.  Is there anything odd about the source file?  Is it
possible that it is somehow padded?

Anyway, I think the garbage problem could be accounted for if the output
file was opened without specifying "binary" - and I guess if you fix that,
you may not care so much about the size mystery!

Hope this helps,
 
  Ben Rubinstein               |  Email: benr_mc at cogapp.com
  Cognitive Applications Ltd   |  Phone: +44 (0)1273-821600
  http://www.cogapp.com        |  Fax  : +44 (0)1273-728866





More information about the use-livecode mailing list