welcome yugesh,

Here a list converted into string example, we can many more using tcl

set msg1 0010101001010101010101010
set msg2 1010101010101011110001010

set msg1 [split $msg1 {}]
set msg2 [split $msg2 {}]
set s 0

for {set i 0} {$i < [llength $msg1]} {incr i} {
    set temp [lappend temp [expr [lindex $msg1 $i]^[lindex $msg2 $i]]]
}
puts $temp

for {set i 0} {$i < [llength $temp]} {incr i} {
    set s [concat $s[lindex $temp $i]]
}
puts "List converted into string $s"


On 9 May 2011 10:38, yugesh gowda <yugeshgo...@gmail.com> wrote:

> Thanks for your help..
> Its working properly..
> But i dont need any space between them..
> The output should like msg1.. no space in between 1s and 0s...
> Waiting for ur reply...
>
>
>
>
>
>
>
>
> On Mon, May 9, 2011 at 10:26 AM, мαłłi <malli....@gmail.com> wrote:
>
>> yes yugesh,
>>
>> ^ operator is used of XOR operation, you go thourgh tcl wiki it is very
>> good one please refer this link http://wiki.tcl.tk/17464
>> Math Operations on Binary Numbers: http://wiki.tcl.tk/21842
>>
>>
>> set msg1 0010101001010101010101010
>> set msg2 1010101010101011110001010
>>
>> set msg1 [split $msg1 {}]
>> set msg2 [split $msg2 {}]
>>
>> for {set i 0} {$i < [llength $msg1]} {incr i} {
>>     set temp [lappend temp [expr [lindex $msg1 $i]^[lindex $msg2 $i]]]
>> }
>> puts $temp
>>
>>
>> 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 1 0 0 1 0 0 0 0 0
>>
>> please let me know if i did any mistake.
>>
>>
>> On 9 May 2011 09:26, yugesh gowda <yugeshgo...@gmail.com> wrote:
>>
>>>
>>> Can any one help me with a tcl program that does XOR operation..
>>> For example consider two variables msg1 and msg2...
>>> set msg1 0010101001010101010101010
>>> set msg2 1010101010101011110001010
>>>
>>>
>>> Urgent....
>>>
>>>
>>
>>
>> --
>>
>> Thanks,
>>
>> The box said "Requires Windows 95, NT, or better", so I installed Linux.
>>
>> Mallikarjun [:)]
>>
>> [image: YouTube] <http://in.youtube.com/mallikv> [image: 
>> Blogger]<http://basicnetworktipsntricks.blogspot.com/> [image:
>> LinkedIn] <http://www.linkedin.com/in/mallikarjunaraok>
>>
>
>


-- 

Thanks,

The box said "Requires Windows 95, NT, or better", so I installed Linux.

Mallikarjun [:)]

[image: YouTube] <http://in.youtube.com/mallikv> [image:
Blogger]<http://basicnetworktipsntricks.blogspot.com/> [image:
LinkedIn] <http://www.linkedin.com/in/mallikarjunaraok>

Reply via email to