TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
vishal chavan
NA
7
9.3k
comparing two ms word, ms excel, powerpoint files
Jan 3 2015 2:56 PM
I want to compare two files.. so i m using this code.. but i m getting wrong ans while comparing.. even two ms word files that i hv created are totally same.. still i m nt getting correct output.. thank you..
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private bool filecompare(string file1, string file2)
{
int file1byte;
int file2byte;
FileStream fs1;
FileStream fs2;
if (file1 == file2)
{
return true;
}
fs1 = new FileStream(file1, FileMode.Open);
fs2 = new FileStream(file2, FileMode.Open);
if (fs1.Length == fs2.Length)
{
fs1.Close();
fs2.Close();
return false;
}
do
{
file1byte = fs1.ReadByte();
file2byte = fs2.ReadByte();
}
while ((file1byte == file2byte) || (file1byte != -1));
fs1.Close();
fs2.Close();
return ((file1byte - file2byte) == 0);
}
private void button1_Click(object sender, EventArgs e)
{
if (filecompare(this.textBox1.Text, this.textBox2.Text))
{
MessageBox.Show("File are equals ");
}
else
{
MessageBox.Show("files are not equal");
}
}
}
}
Reply
Answers (
1
)
upload excel file save data to in sql different tables
insert excel data to sql