dle Posted November 6, 2014 Posted November 6, 2014 Hi all, I'm trying to compare 2 files to see if they are match using the code below Private String Original_File Private String Received_File Private File_Compare Original_File = File.Open("C:\OriginalTestFile.txt",1,0,0,0) Received_File = File.Open("C:\TestRadio.txt",1,0,0,0) File_Compare = Compare(Original_File, Received_File) The File_Compare = -1 even though the content of the 2 files are identical and no matter if I put Receive_File to be String# 1 or #2 inside the compare () Please help! Thanks,
AzeoTech Posted November 6, 2014 Posted November 6, 2014 That's because File.Open() doesn't actually read the file, it simply opens it and returns a handle. You need to use File.Read() to read the whole file into a string using that handle. Then you can compare the result. Don't forget to close the file too.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.