473,405 Members | 2,185 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Issue comaring two files

1
Hi,

This question is slightly different to the topic above but I noticed that the code being used above is similar to above.

I'm trying to compare 2 text files and find out whether they contain the same data.

Here's my code:

Expand|Select|Wrap|Line Numbers
  1. use File::Compare;
  2.  
  3. if (compare("C:\files\a.txt","C:\files\b.txt") == 0) {
  4.      print "They're equal\n";
  5.     } else {
  6.         print "They are not equal";
  7.         }
  8.  
The odd thing is, is that it always said the files are not equal. Even if I try and compare the same file it says they are not equal.

Can anyone shed some light on this?

Thanks

Nush
Sep 20 '07 #1
2 1214
numberwhun
3,509 Expert Mod 2GB
Hi,

This question is slightly different to the topic above but I noticed that the code being used above is similar to above.

I'm trying to compare 2 text files and find out whether they contain the same data.

Here's my code:

Expand|Select|Wrap|Line Numbers
  1. use File::Compare;
  2.  
  3. if (compare("C:\files\a.txt","C:\files\b.txt") == 0) {
  4.      print "They're equal\n";
  5.     } else {
  6.         print "They are not equal";
  7.         }
  8.  
The odd thing is, is that it always said the files are not equal. Even if I try and compare the same file it says they are not equal.

Can anyone shed some light on this?

Thanks

Nush
I am not really sure about the module you are using as I haven't looked at it before. But, in the mean time, the issue you are having is actually more different than you think from the rest of the thread. The other person is taking multiple files and combining them into one file, minus any duplicate lines from the files that may exist.

You, on the other hand, just want to compare two files to see if they are the same.

It is a bad idea to piggy back your question onto someone elses thread as you may find it will possibly be missed. It is always best to start a new thread.

Regards,

Jeff
Sep 21 '07 #2
numberwhun
3,509 Expert Mod 2GB
Hi,

This question is slightly different to the topic above but I noticed that the code being used above is similar to above.

I'm trying to compare 2 text files and find out whether they contain the same data.

Here's my code:

Expand|Select|Wrap|Line Numbers
  1. use File::Compare;
  2.  
  3. if (compare("C:\files\a.txt","C:\files\b.txt") == 0) {
  4.      print "They're equal\n";
  5.     } else {
  6.         print "They are not equal";
  7.         }
  8.  
The odd thing is, is that it always said the files are not equal. Even if I try and compare the same file it says they are not equal.

Can anyone shed some light on this?

Thanks

Nush
Due to the reason I stated in my post above, I have split your question off into its own thread so that it can better receive its due attention.

Please do not piggy back onto another person's thread unless it is input relevant to their question.

Thank you! and Welcome to TSDN forums!!!

Regards,

Jeff
Sep 21 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: bc | last post by:
Hello all, Background: I've posted a couple questions recently regarding using BCP to extract many tables to text files. I've written an extract application that bcp's about 100 tables from a...
2
by: George Durzi | last post by:
I have a dll that I use in several projects, that I placed in the Global Assembly Cache. This dll is references in each of my projects. This Dll is referenced by a type= declaration in my...
1
by: csgraham74 | last post by:
Hi, I have a problem with the deployment of my software. I have built my system using the following structure c:\inetpub\wwwroot\Myfolder. When I deploy my system i do not really deploy my...
1
by: Robert | last post by:
I have a server where the main web application (root) is now migrated to 2.0. It's web.config has a line where it adds the system.data.oracleclient in the configuration and assembiles section. ...
3
by: Jeff G | last post by:
When I build the deployment project for an application everything works. However, the two files instmsia.exe and instmsiw.exe do not appear with the setup files. I may be installing this on...
1
by: AlekseyUS | last post by:
Hi, I'm a little stuck, I basically need to copy all the information within a specific file in Temp and append it to a file in another location. I'm not having any problems with smaller size...
10
by: Schraalhans Keukenmeester | last post by:
I suspect the following problem IS hosting provider specific, but they haven't been able to help me out so far. Perhaps I am doing something wrong and someone is able to spot the issue... Here...
1
by: SlashDrew | last post by:
I had the issue in which modal windows would spawn new windows on a .NET postback, and so like a good developer, I added <base target="_self" /to the .aspx page and everything worked fine. Now,...
8
by: Ollie Riches | last post by:
I'm looking into a production issue related to a windows service and System.Timers.Timer. The background is the windows service uses a System.Timers.Timer to periodically poll a directory location...
2
by: srinivembu | last post by:
Hi, I have linked libcurl library (v7.19.6) statically with my C++ application. Using curl, we upload & download files to/from the window azure storage webservice using https. The download works...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.