2008/11/23 Chas. Owens <[EMAIL PROTECTED]>:
>
>
> On Nov 23, 2008, at 2:52, loody <[EMAIL PROTECTED]> wrote:
>
>> Dear all:
>> 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);
Hi:
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.


>
> Depending on which you prefer.  Also, if you are going to be working with
> raw bytes it is a good idea to say
>
> use bytes;
>
> At the top of your program to avoid unicode issues.

I have look the page you give to me, http://perldoc.perl.org/bytes.html
it seems I may not need it in my case, since I compare 2 lines of 2
images and rewrite the error part.
If I am wrong, please let me know.
appreciate your help,
miloody

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to