loody wrote:
2008/11/23 Chas. Owens <[EMAIL PROTECTED]>:
On Nov 23, 2008, at 2:52, loody <[EMAIL PROTECTED]> wrote:
The prototype of read is
read FILEHANDLE,SCALAR,LENGTH
ex:
read PATTERN, $line, 1920;
that means the $line will content 1920 bytes.
if I want to modify the byte offset 720 of $line, it seems impossible,
But happily it isn't. You have several choices, but without more
information I would suggest substr*:
substr($line, 720, 1) = $new_byte;
Or
substr($line, 720, 1, $new_byte);
thanks for your kind help.
I apologize for not explain my problem detail.
Below is my source code:
$end_gold=sysread GOLDEN, $tmp_gold, $image_resolution_w[$idx];
$end_result=sysread RESULT, $tmp_result, $image_resolution_w[$idx];
if($tmp_gold ne $tmp_result)
{
print CMPREPORT "Frame index: $frame, UV line:
$tmp_height error\n";
}
As you can see, I only can tell which line of UV part in both images
get different.
Right now I want to high light the error part of this 2 lines as 0xFF,
such that I can see the error part as bright red.
Your suggestion is good, but the difficulties comes I don't exactly
know where the error offset of these 2 lines.
I got a stupid idea as read 2 files byte to byte to 2 arrays and
compare them one by one.
But it is really un-efficient.
Sorry, but you haven't provided enough details to even guess at what you
are trying to do.
What sizes are the files you are working with? Are they "text" or
"binary"? Do they have fixed length records, variable length records or
no records at all? Do you want to modify the files or just display the
differences on the screen?
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/