Click here to Skip to main content
15,908,626 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# program structuring problem - Run in background - Teach a noob to do it properly :P Pin
Rob Philpott19-Feb-09 6:34
Rob Philpott19-Feb-09 6:34 
GeneralRe: C# program structuring problem - Run in background - Teach a noob to do it properly :P Pin
samskiter19-Feb-09 6:57
samskiter19-Feb-09 6:57 
Questionhow to drag and drop image in c#.net & how to resize it after drop the image? Pin
poonam jagdale19-Feb-09 2:32
poonam jagdale19-Feb-09 2:32 
AnswerRe: how to drag and drop image in c#.net & how to resize it after drop the image? Pin
Calin Tatar19-Feb-09 2:37
Calin Tatar19-Feb-09 2:37 
QuestionMin (110) must be less than or equal to max (-1) in a Range object. Pin
Priya Prk19-Feb-09 2:01
Priya Prk19-Feb-09 2:01 
GeneralRe: Min (110) must be less than or equal to max (-1) in a Range object. Pin
Luc Pattyn19-Feb-09 2:13
sitebuilderLuc Pattyn19-Feb-09 2:13 
AnswerRe: Min (110) must be less than or equal to max (-1) in a Range object. Pin
michal.drozdowicz23-Mar-09 5:03
michal.drozdowicz23-Mar-09 5:03 
QuestionCompare two .DAT file using C# Pin
Member 322226419-Feb-09 1:52
Member 322226419-Feb-09 1:52 
i want to compare two .dat file.One .dat file contains lines of file name with it record count and size.

MRR_GIQ_FR_X03_M0808_GIQDTL_GIQDTLCTCT.dat~612~3~
MRR_GIQ_FR_X03_M0808_GIQDTL_GIQDTLDETL.dat~1036~3~
MRR_GIQ_FR_X03_M0808_GIQDTL_GIQDTLMTG.dat~875~3~

We need to write a code to compare each .dat file with .dat file.

when record count and size differ it must exit,else continue with next file.

my code is

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.IO.Compression;



namespace ConsoleApplication1
{
class Class1
{
public bool splitFile = false;


static void Main(string[] args)
{
CompareFiles();
}
//Compare 2 files

public static void CompareFiles()
{

string srcFile = "C:\\SampleFile\\MRR_GIQ_FR_X03_M0808_GIQDTL_GIQDTLCTCT.dat";

string destFile = "C:\\SampleFile\\MRR_GIQ_FR_X03_M0808_STATS.dat";
if (Class1.FileCompare(srcFile,destFile))
{
Console.Write("Files are equal.");
}
else
{
Console.Write("Files are not equal.");
}

}

private static bool FileCompare(string file1, string file2)
{
int file1byte;
int file2byte;
FileStream fs1;
FileStream fs2;

// Determine if the same file was referenced two times.
if (file1 == file2)
{
// Return true to indicate that the files are the same.
return true;
}

// Open the two files.
fs1 = new FileStream(file1, FileMode.Open);
fs2 = new FileStream(file2, FileMode.Open);

// Check the file sizes. If they are not the same, the files
// are not the same.
if (fs1.Length != fs2.Length)
{
I NEED THE CODE HERE TO COMPARE THESE TWO DAT FILE

}

// Read and compare a byte from each file until either a
// non-matching set of bytes is found or until the end of
// file1 is reached.
do
{
// Read one byte from each file.
file1byte = fs1.ReadByte();
file2byte = fs2.ReadByte();
}
while ((file1byte == file2byte) && (file1byte != -1));

// Close the files.
fs1.Close();
fs2.Close();

// Return the success of the comparison. "file1byte" is
// equal to "file2byte" at this point only if the files are
// the same.
return ((file1byte - file2byte) == 0);
}
PLEASE HELP WITH CODE OR ANY USEFUL LINKS.........
AnswerRe: Compare two .DAT file using C# Pin
Luc Pattyn19-Feb-09 2:20
sitebuilderLuc Pattyn19-Feb-09 2:20 
Questioncreating a setup file Pin
aratireddy19-Feb-09 1:26
aratireddy19-Feb-09 1:26 
AnswerRe: creating a setup file Pin
Ramkithepower19-Feb-09 1:38
Ramkithepower19-Feb-09 1:38 
GeneralRe: creating a setup file Pin
Calin Tatar19-Feb-09 1:52
Calin Tatar19-Feb-09 1:52 
AnswerRe: creating a setup file Pin
Nuri Ismail19-Feb-09 2:20
Nuri Ismail19-Feb-09 2:20 
QuestionReading specific no if bytes from an UDP datagram [modified] Pin
M. J. Jaya Chitra19-Feb-09 0:51
M. J. Jaya Chitra19-Feb-09 0:51 
QuestionRead lines in PDF file Pin
abbd19-Feb-09 0:24
abbd19-Feb-09 0:24 
AnswerRe: Read lines in PDF file Pin
Deresen19-Feb-09 1:01
Deresen19-Feb-09 1:01 
GeneralRe: Read lines in PDF file Pin
abbd19-Feb-09 1:22
abbd19-Feb-09 1:22 
GeneralRe: Read lines in PDF file Pin
Pete O'Hanlon19-Feb-09 1:47
mvePete O'Hanlon19-Feb-09 1:47 
QuestionWeather Forecast webservice Pin
ranandbe19-Feb-09 0:11
ranandbe19-Feb-09 0:11 
AnswerRe: Weather Forecast webservice Pin
Eddy Vluggen19-Feb-09 0:43
professionalEddy Vluggen19-Feb-09 0:43 
QuestionVisual Studio Setup project !!! Is it just another kind of Wizard? Pin
Nadia Monalisa18-Feb-09 23:16
Nadia Monalisa18-Feb-09 23:16 
AnswerRe: Visual Studio Setup project !!! Is it just another kind of Wizard? Pin
Calin Tatar18-Feb-09 23:29
Calin Tatar18-Feb-09 23:29 
AnswerRe: Visual Studio Setup project !!! Is it just another kind of Wizard? Pin
Nuri Ismail18-Feb-09 23:32
Nuri Ismail18-Feb-09 23:32 
Questionthread splach screen !!! Pin
mrcooll18-Feb-09 23:03
mrcooll18-Feb-09 23:03 
QuestionAuto Login Pin
Member 299896918-Feb-09 21:39
Member 299896918-Feb-09 21:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.