ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about files comparing .....

"Hi !

I have Labview 4.0.1 on Windows-NT:

To compare 2 files i'm ussing 2 "Read characters file.vi" when the
"characters string" output of this 2 functions is connect to one
"Comparison Equal ?" symbol, which it's output is connect to an LED
indicator on the front panel.

"When i Run this application i choose the 2 files for compare ( using
the file browswer ) and as a result i get the Led On/Off ( Equal or Not
Equal ).

My question is if what i did good also for comparing large files for
example if i want to compare the files "Test1.exe" and "Test2.exe" which
are 7 Mbytes ( each one ). i ask this becouse i remember that there is a
limit
for the number of chars in the string i can send to the input of the
"Comparison
Equal ?" symbol, is it true ? is there a limit ? ( Becouse a
7 Mbytes file is a very very long string ..... and i want to be sure
that the comparing is done NOT only on the beginning of this files but
on ALL the file from first till last character )

I hope you understood, please answer as soon, thanks.

Noam.
0 Kudos
Message 1 of 2
(2,853 Views)
Hi Noam,

The way I would do it is as follows...

Read in medium-sized chunks of the file at a time (100 kB) and compare
these. Retain the file position indicator in a FOR loop, read the next
portion and perform an "AND" logic function on the comparison from the last
loop and this loop. This way a TRUE match will remain intact until a FALSE
comparison is recorded which will then propagate throughout the iterations.
At the end the boolean will tell you if there were any mis-matches along the
way.

This won`t work of course if you want to compare EVERY byte of the files and
thus generate millions of TRUE/FALSE answers.

Hope it helps

Shane


opgal schrieb in Nachricht <3B02DB27.ACD87CA0@netvision.net.il>...
>"Hi !
>
>I have Labview 4.0.1 on Windows-NT:
>
>To compare 2 f
iles i'm ussing 2 "Read characters file.vi" when the
>"characters string" output of this 2 functions is connect to one
>"Comparison Equal ?" symbol, which it's output is connect to an LED
>indicator on the front panel.
>
>"When i Run this application i choose the 2 files for compare ( using
>the file browswer ) and as a result i get the Led On/Off ( Equal or Not
>Equal ).
>
>My question is if what i did good also for comparing large files for
>example if i want to compare the files "Test1.exe" and "Test2.exe" which
>are 7 Mbytes ( each one ). i ask this becouse i remember that there is a
>limit
>for the number of chars in the string i can send to the input of the
>"Comparison Equal ?" symbol, is it true ? is there a limit ? ( Becouse a
>7 Mbytes file is a very very long string ..... and i want to be sure
>that the comparing is done NOT only on the beginning of this files but
>on ALL the file from first till last character )
>
>I hope you understood, please answer as soon, thanks.
>
>No
am.
>
>
>
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 2
(2,853 Views)