No announcement yet.

Calling BC2.exe from C++ application

  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling BC2.exe from C++ application

    I have an application written in C++. In some point of the application I have two files I want to compare using BC2.exe.
    Is there a way to Execute a command line that will compare the two files?
    I tried ShellExecute but did not succeed.


  • #2
    Re: Calling BC2.exe from C++ application

    Do you want to generate a comparison report, or do you want to get comparison results back as a DOS error level?

    To generate a comparison report of two named files, use the "file-report" scripting command.


    file-report layout:side-by-side output-to:%3 %1 %2

    To call the script, use:
    BC2.exe /silent @script.txt c:\file1.txt c:\file2.txt c:\report.txt

    To get the comparison results returned as a DOS error level, use the BCQC.exe utility included with BC 2.4.3.

    Here are the command line options for BCQC.exe. To list them call the program with no arguments.

    QuickCompare for Beyond Compare 2
    Copyright (c) 2005 Scooter Software, Inc.

    Syntax: bcqc [options] filename filename

    /size, /s = size-only comparison
    /crc, /c = CRC32 comparison
    /binary, /b = binary comparison
    /rules[=rules name], /r = rules-based comparison
    /selftest = run a self test (omit filenames)

    The /rules switch can optionally include the name of an
    existing rules set. If the rules name is omitted the rules
    will be picked automatically based on the file names.

    Comparison result is returned as the DOS ErrorLevel
    0 = files match
    1 = files only contain unimportant differences
    2 = files do not match
    3 = error, result unknown

    To compare the text contents of two text files, use the command:

    bcqc.exe /rules c:\file1.txt c:\file2.txt
    Chris K Scooter Software


    • #3
      Re: Calling BC2.exe from C++ application

      Thanks for your answer.
      I want "beyond compare" to be lunched with the two files on the right and left. I have the files full path in runtime.
      How do I use a C++/win32 comand to run bc2.exe with the file path as parameters in my application?




      • #4
        Re: Calling BC2.exe from C++ application

        If you want to launch BC2 such that the user interacts with the program, you can determine what command line and arguments you need by using a Command Prompt window, then pass those arguments to the Windows runtime procedure called CreateProcess.