CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Location
    Strasbourg, France
    Posts
    116

    [question] Class structure

    Hello again,

    I need to create a program that'll compare 2 files, what i wish to do is something like this :
    Code:
    /--------------------------------------------------------------------\
    |   Header | Info | Info | Info ....                                 |
    \--------------------------------------------------------------------/
                                  File 1
    
    /--------------------------------------------------------------------\
    |   Header | Info2 | Info2 | Info2 ....                              |
    \--------------------------------------------------------------------/
                                  Info
    
    _________________________________________________________________________
    
    Class tree
    _________________________________________________________________________
    
             Compare       Functions
                |
                |
                V
              File
               /\
              /  \
             /    \
            /      \
         Header   Info
                   /\
                  /  \
                 /    \
                /      \
              Header2    Info2
    Where i would instanciate 1 Comp class and 2 files. I wish to store the data of each files in a series of classes.
    1) Will I be able to say for example (pseudo code)
    File(1).Info(2).Info2(1) == File(2).Info(7).Info2(2) ?

    2) How can I access the set of functions I created in a separate class Function (may include some global variables). I mean, if i do something like this Function f = new Function() and Info2 do f.SetAVariable(myValue)
    can Header do f.GetAVariable and get myValue ?

    Thanks for your time guys

  2. #2
    Join Date
    Dec 2008
    Posts
    144

    Re: [question] Class structure

    If you're just comparing files to see if they are identical, then you don't need separate classes. Just read the files and compare the length. If that's the same then you can read bytes to compare.
    Code:
    if (Issue.Resolved)
    {
         ThreadTools.Click();
         MarkThreadResolved();
    }

  3. #3
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: [question] Class structure

    Also: some tools already exist for this problem. diff on linux/unix or WinMerge on Windows are good choices.
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  4. #4
    Join Date
    Feb 2012
    Location
    Strasbourg, France
    Posts
    116

    Re: [question] Class structure

    Won't work as the comparison has to be automatic without human intervention. I have to compare the whole file but be able to reconize in which section of the file I am because files will be legitmately different on some zones, and I need to find these zones. Furthermore zones pos are not static at all and relies on information provided by carfully reaing file's data

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured