Windows PlatformSDK 中有个例子, sdkdiff, 比较文本文件差别并图形化显示差别
diff貌似是linux下的吧
我是windows下的
#8
Windows PlatformSDK 中有个例子, sdkdiff, 比较文本文件差别并图形化显示差别
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Begin\sdkdiff\readme.txt
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
SDKDiff Sample
-------------------------------
Abstract:
SDKDiff allows the users to compare two files or two directories
against each other, and display the differences found between the
files or directories on the screen.
The differences are displayed textually and graphically. Graphically,
data that exists in the first file but does not exist in the second file
is represented by a red line, whereas data that does not exist in the first
file but exists in the second file is represented by yellow line.
The identical parts of the files are displayed in black line. The 2 lines, one
for each file, made up of different colors based on blocks of identical or
different blocks of data in the files.
Both files are displayed simultaneously. They are virtually mapped to one file,
where the lines that only appear in the first file are highlighted in red, and
the lines that only appear in the left file are highlighted in yellow.
Supported OS:
Windows 2000, Windows XP
Building:
Build the sample using the latest Platform SDK via the MAKEFILE included.
For building in Visual Studio, use the sdkdiff.vcproj for Visual Studio.NET and
sdkdiff.dsp for Visual Studio 6.0.
Usage:
The sample can be run directly on the command-line by typing 'sdkdiff'.
This starts the sdkdiff program, and the files or directories to be compared can
be chosen via the menus in the program: File->Compare Files or File->Compare Directories.
Special Note for 64-bit Build Environments:
This sample builds a binary sample and an associated help file. In some 64-bit
environments, NMAKE is unable to find the help compiler to build the help file
and will fail. As a result, help-related functions in this sample will be unable
to find the help file. To resolve this problem, build the sample in a 32-bit
environment and then copy the help file to the output directory of the 64-bit
build environment. Alternatively, add the path of the HCRTF.EXE tool (located
in the installed Visual Studio distribution) to the "PATH" environment variable.
#9
Windows PlatformSDK 中有个例子, sdkdiff, 比较文本文件差别并图形化显示差别
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Begin\sdkdiff\readme.txt
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
SDKDiff Sample
-------------------------------
Abstract:
SDKDiff allows the users to compare two files or two directories
against each other, and display the differences found between the
files or directories on the screen.
The differences are displayed textually and graphically. Graphically,
data that exists in the first file but does not exist in the second file
is represented by a red line, whereas data that does not exist in the first
file but exists in the second file is represented by yellow line.
The identical parts of the files are displayed in black line. The 2 lines, one
for each file, made up of different colors based on blocks of identical or
different blocks of data in the files.
Both files are displayed simultaneously. They are virtually mapped to one file,
where the lines that only appear in the first file are highlighted in red, and
the lines that only appear in the left file are highlighted in yellow.
Supported OS:
Windows 2000, Windows XP
Building:
Build the sample using the latest Platform SDK via the MAKEFILE included.
For building in Visual Studio, use the sdkdiff.vcproj for Visual Studio.NET and
sdkdiff.dsp for Visual Studio 6.0.
Usage:
The sample can be run directly on the command-line by typing 'sdkdiff'.
This starts the sdkdiff program, and the files or directories to be compared can
be chosen via the menus in the program: File->Compare Files or File->Compare Directories.
Special Note for 64-bit Build Environments:
This sample builds a binary sample and an associated help file. In some 64-bit
environments, NMAKE is unable to find the help compiler to build the help file
and will fail. As a result, help-related functions in this sample will be unable
to find the help file. To resolve this problem, build the sample in a 32-bit
environment and then copy the help file to the output directory of the 64-bit
build environment. Alternatively, add the path of the HCRTF.EXE tool (located
in the installed Visual Studio distribution) to the "PATH" environment variable.
Windows PlatformSDK 中有个例子, sdkdiff, 比较文本文件差别并图形化显示差别
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Begin\sdkdiff\readme.txt
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
SDKDiff Sample
-------------------------------
Abstract:
SDKDiff allows the users to compare two files or two directories
against each other, and display the differences found between the
files or directories on the screen.
The differences are displayed textually and graphically. Graphically,
data that exists in the first file but does not exist in the second file
is represented by a red line, whereas data that does not exist in the first
file but exists in the second file is represented by yellow line.
The identical parts of the files are displayed in black line. The 2 lines, one
for each file, made up of different colors based on blocks of identical or
different blocks of data in the files.
Both files are displayed simultaneously. They are virtually mapped to one file,
where the lines that only appear in the first file are highlighted in red, and
the lines that only appear in the left file are highlighted in yellow.
Supported OS:
Windows 2000, Windows XP
Building:
Build the sample using the latest Platform SDK via the MAKEFILE included.
For building in Visual Studio, use the sdkdiff.vcproj for Visual Studio.NET and
sdkdiff.dsp for Visual Studio 6.0.
Usage:
The sample can be run directly on the command-line by typing 'sdkdiff'.
This starts the sdkdiff program, and the files or directories to be compared can
be chosen via the menus in the program: File->Compare Files or File->Compare Directories.
Special Note for 64-bit Build Environments:
This sample builds a binary sample and an associated help file. In some 64-bit
environments, NMAKE is unable to find the help compiler to build the help file
and will fail. As a result, help-related functions in this sample will be unable
to find the help file. To resolve this problem, build the sample in a 32-bit
environment and then copy the help file to the output directory of the 64-bit
build environment. Alternatively, add the path of the HCRTF.EXE tool (located
in the installed Visual Studio distribution) to the "PATH" environment variable.
我咋感觉这个貌似跟一个工具很想啊 叫什么compare 就是代码差异比较器很相似啊
可是我不是要显示那些错的那些对的在屏幕上 我要的是统计的结果
人家领导就是要统计结果 数字
我觉得这个sdkdiff好牛啊 可是跟我的程序怎么对接啊
#10
strcmp, wcscmp, _mbscmp
Compare strings.
int strcmp( const char *string1, const char *string2 );
int wcscmp( const wchar_t *string1, const wchar_t *string2 );
int _mbscmp(const unsigned char *string1, const unsigned char *string2 );
Routine Required Header Compatibility
strcmp <string.h> ANSI, Win 95, Win NT
wcscmp <string.h> or <wchar.h> ANSI, Win 95, Win NT
_mbscmp <mbstring.h> Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
The return value for each of these functions indicates the lexicographic relation of string1 to string2.
Value Relationship of string1 to string2
< 0 string1 less than string2
0 string1 identical to string2
> 0 string1 greater than string2
On an error, _mbscmp returns _NLSCMPERROR, which is defined in STRING.H and MBSTRING.H.
Parameters
string1, string2
Null-terminated strings to compare
Remarks
The strcmp function compares string1 and string2 lexicographically and returns a value indicating their relationship. wcscmp and _mbscmp are wide-character and multibyte-character versions of strcmp. The arguments and return value of wcscmp are wide-character strings; those of _mbscmp are multibyte-character strings. _mbscmp recognizes multibyte-character sequences according to the current multibyte code page and returns _NLSCMPERROR on an error. (For more information, see Code Pages.) These three functions behave identically otherwise.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_tcscmp strcmp _mbscmp wcscmp
The strcmp functions differ from the strcoll functions in that strcmp comparisons are not affected by locale, whereas the manner of strcoll comparisons is determined by the LC_COLLATE category of the current locale. For more information on the LC_COLLATE category, see setlocale.
In the “C” locale, the order of characters in the character set (ASCII character set) is the same as the lexicographic character order. However, in other locales, the order of characters in the character set may differ from the lexicographic order. For example, in certain European locales, the character 'a' (value 0x61) precedes the character 'ä' (value 0xE4) in the character set, but the character 'ä' precedes the character 'a' lexicographically.
In locales for which the character set and the lexicographic character order differ, use strcoll rather than strcmp for lexicographic comparison of strings according to the LC_COLLATE category setting of the current locale. Thus, to perform a lexicographic comparison of the locale in the above example, use strcoll rather than strcmp. Alternatively, you can use strxfrm on the original strings, then use strcmp on the resulting strings.
_stricmp, _wcsicmp, and _mbsicmp compare strings by first converting them to their lowercase forms.Two strings containing characters located between 'Z' and 'a' in the ASCII table ('[', '\', ']', '^', '_', and '`') compare differently, depending on their case. For example, the two strings "ABCDE" and "ABCD^" compare one way if the comparison is lowercase ("abcde" > "abcd^") and the other way ("ABCDE" < "ABCD^") if the comparison is uppercase.
Example
/* STRCMP.C */
#include <string.h>
#include <stdio.h>
char string1[] = "The quick brown dog jumps over the lazy fox";
char string2[] = "The QUICK brown dog jumps over the lazy fox";
void main( void )
{
char tmp[20];
int result;
/* Case sensitive */
printf( "Compare strings:\n\t%s\n\t%s\n\n", string1, string2 );
result = strcmp( string1, string2 );
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
printf( "\tstrcmp: String 1 is %s string 2\n", tmp );
/* Case insensitive (could use equivalent _stricmp) */
result = _stricmp( string1, string2 );
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
printf( "\t_stricmp: String 1 is %s string 2\n", tmp );
}
Output
Compare strings:
The quick brown dog jumps over the lazy fox
The QUICK brown dog jumps over the lazy fox
strcmp: String 1 is greater than string 2
_stricmp: String 1 is equal to string 2
String Manipulation Routines
See Also memcmp, _memicmp, strcoll Functions, _stricmp, strncmp, _strnicmp, strrchr, strspn, strxfrm
Windows PlatformSDK 中有个例子, sdkdiff, 比较文本文件差别并图形化显示差别
diff貌似是linux下的吧
我是windows下的
#8
Windows PlatformSDK 中有个例子, sdkdiff, 比较文本文件差别并图形化显示差别
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Begin\sdkdiff\readme.txt
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
SDKDiff Sample
-------------------------------
Abstract:
SDKDiff allows the users to compare two files or two directories
against each other, and display the differences found between the
files or directories on the screen.
The differences are displayed textually and graphically. Graphically,
data that exists in the first file but does not exist in the second file
is represented by a red line, whereas data that does not exist in the first
file but exists in the second file is represented by yellow line.
The identical parts of the files are displayed in black line. The 2 lines, one
for each file, made up of different colors based on blocks of identical or
different blocks of data in the files.
Both files are displayed simultaneously. They are virtually mapped to one file,
where the lines that only appear in the first file are highlighted in red, and
the lines that only appear in the left file are highlighted in yellow.
Supported OS:
Windows 2000, Windows XP
Building:
Build the sample using the latest Platform SDK via the MAKEFILE included.
For building in Visual Studio, use the sdkdiff.vcproj for Visual Studio.NET and
sdkdiff.dsp for Visual Studio 6.0.
Usage:
The sample can be run directly on the command-line by typing 'sdkdiff'.
This starts the sdkdiff program, and the files or directories to be compared can
be chosen via the menus in the program: File->Compare Files or File->Compare Directories.
Special Note for 64-bit Build Environments:
This sample builds a binary sample and an associated help file. In some 64-bit
environments, NMAKE is unable to find the help compiler to build the help file
and will fail. As a result, help-related functions in this sample will be unable
to find the help file. To resolve this problem, build the sample in a 32-bit
environment and then copy the help file to the output directory of the 64-bit
build environment. Alternatively, add the path of the HCRTF.EXE tool (located
in the installed Visual Studio distribution) to the "PATH" environment variable.
#9
Windows PlatformSDK 中有个例子, sdkdiff, 比较文本文件差别并图形化显示差别
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Begin\sdkdiff\readme.txt
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
SDKDiff Sample
-------------------------------
Abstract:
SDKDiff allows the users to compare two files or two directories
against each other, and display the differences found between the
files or directories on the screen.
The differences are displayed textually and graphically. Graphically,
data that exists in the first file but does not exist in the second file
is represented by a red line, whereas data that does not exist in the first
file but exists in the second file is represented by yellow line.
The identical parts of the files are displayed in black line. The 2 lines, one
for each file, made up of different colors based on blocks of identical or
different blocks of data in the files.
Both files are displayed simultaneously. They are virtually mapped to one file,
where the lines that only appear in the first file are highlighted in red, and
the lines that only appear in the left file are highlighted in yellow.
Supported OS:
Windows 2000, Windows XP
Building:
Build the sample using the latest Platform SDK via the MAKEFILE included.
For building in Visual Studio, use the sdkdiff.vcproj for Visual Studio.NET and
sdkdiff.dsp for Visual Studio 6.0.
Usage:
The sample can be run directly on the command-line by typing 'sdkdiff'.
This starts the sdkdiff program, and the files or directories to be compared can
be chosen via the menus in the program: File->Compare Files or File->Compare Directories.
Special Note for 64-bit Build Environments:
This sample builds a binary sample and an associated help file. In some 64-bit
environments, NMAKE is unable to find the help compiler to build the help file
and will fail. As a result, help-related functions in this sample will be unable
to find the help file. To resolve this problem, build the sample in a 32-bit
environment and then copy the help file to the output directory of the 64-bit
build environment. Alternatively, add the path of the HCRTF.EXE tool (located
in the installed Visual Studio distribution) to the "PATH" environment variable.
Windows PlatformSDK 中有个例子, sdkdiff, 比较文本文件差别并图形化显示差别
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Begin\sdkdiff\readme.txt
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Copyright (C) 1999 Microsoft Corporation. All Rights Reserved.
SDKDiff Sample
-------------------------------
Abstract:
SDKDiff allows the users to compare two files or two directories
against each other, and display the differences found between the
files or directories on the screen.
The differences are displayed textually and graphically. Graphically,
data that exists in the first file but does not exist in the second file
is represented by a red line, whereas data that does not exist in the first
file but exists in the second file is represented by yellow line.
The identical parts of the files are displayed in black line. The 2 lines, one
for each file, made up of different colors based on blocks of identical or
different blocks of data in the files.
Both files are displayed simultaneously. They are virtually mapped to one file,
where the lines that only appear in the first file are highlighted in red, and
the lines that only appear in the left file are highlighted in yellow.
Supported OS:
Windows 2000, Windows XP
Building:
Build the sample using the latest Platform SDK via the MAKEFILE included.
For building in Visual Studio, use the sdkdiff.vcproj for Visual Studio.NET and
sdkdiff.dsp for Visual Studio 6.0.
Usage:
The sample can be run directly on the command-line by typing 'sdkdiff'.
This starts the sdkdiff program, and the files or directories to be compared can
be chosen via the menus in the program: File->Compare Files or File->Compare Directories.
Special Note for 64-bit Build Environments:
This sample builds a binary sample and an associated help file. In some 64-bit
environments, NMAKE is unable to find the help compiler to build the help file
and will fail. As a result, help-related functions in this sample will be unable
to find the help file. To resolve this problem, build the sample in a 32-bit
environment and then copy the help file to the output directory of the 64-bit
build environment. Alternatively, add the path of the HCRTF.EXE tool (located
in the installed Visual Studio distribution) to the "PATH" environment variable.
我咋感觉这个貌似跟一个工具很想啊 叫什么compare 就是代码差异比较器很相似啊
可是我不是要显示那些错的那些对的在屏幕上 我要的是统计的结果
人家领导就是要统计结果 数字
我觉得这个sdkdiff好牛啊 可是跟我的程序怎么对接啊
#10
strcmp, wcscmp, _mbscmp
Compare strings.
int strcmp( const char *string1, const char *string2 );
int wcscmp( const wchar_t *string1, const wchar_t *string2 );
int _mbscmp(const unsigned char *string1, const unsigned char *string2 );
Routine Required Header Compatibility
strcmp <string.h> ANSI, Win 95, Win NT
wcscmp <string.h> or <wchar.h> ANSI, Win 95, Win NT
_mbscmp <mbstring.h> Win 95, Win NT
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version
Return Value
The return value for each of these functions indicates the lexicographic relation of string1 to string2.
Value Relationship of string1 to string2
< 0 string1 less than string2
0 string1 identical to string2
> 0 string1 greater than string2
On an error, _mbscmp returns _NLSCMPERROR, which is defined in STRING.H and MBSTRING.H.
Parameters
string1, string2
Null-terminated strings to compare
Remarks
The strcmp function compares string1 and string2 lexicographically and returns a value indicating their relationship. wcscmp and _mbscmp are wide-character and multibyte-character versions of strcmp. The arguments and return value of wcscmp are wide-character strings; those of _mbscmp are multibyte-character strings. _mbscmp recognizes multibyte-character sequences according to the current multibyte code page and returns _NLSCMPERROR on an error. (For more information, see Code Pages.) These three functions behave identically otherwise.
Generic-Text Routine Mappings
TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_tcscmp strcmp _mbscmp wcscmp
The strcmp functions differ from the strcoll functions in that strcmp comparisons are not affected by locale, whereas the manner of strcoll comparisons is determined by the LC_COLLATE category of the current locale. For more information on the LC_COLLATE category, see setlocale.
In the “C” locale, the order of characters in the character set (ASCII character set) is the same as the lexicographic character order. However, in other locales, the order of characters in the character set may differ from the lexicographic order. For example, in certain European locales, the character 'a' (value 0x61) precedes the character 'ä' (value 0xE4) in the character set, but the character 'ä' precedes the character 'a' lexicographically.
In locales for which the character set and the lexicographic character order differ, use strcoll rather than strcmp for lexicographic comparison of strings according to the LC_COLLATE category setting of the current locale. Thus, to perform a lexicographic comparison of the locale in the above example, use strcoll rather than strcmp. Alternatively, you can use strxfrm on the original strings, then use strcmp on the resulting strings.
_stricmp, _wcsicmp, and _mbsicmp compare strings by first converting them to their lowercase forms.Two strings containing characters located between 'Z' and 'a' in the ASCII table ('[', '\', ']', '^', '_', and '`') compare differently, depending on their case. For example, the two strings "ABCDE" and "ABCD^" compare one way if the comparison is lowercase ("abcde" > "abcd^") and the other way ("ABCDE" < "ABCD^") if the comparison is uppercase.
Example
/* STRCMP.C */
#include <string.h>
#include <stdio.h>
char string1[] = "The quick brown dog jumps over the lazy fox";
char string2[] = "The QUICK brown dog jumps over the lazy fox";
void main( void )
{
char tmp[20];
int result;
/* Case sensitive */
printf( "Compare strings:\n\t%s\n\t%s\n\n", string1, string2 );
result = strcmp( string1, string2 );
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
printf( "\tstrcmp: String 1 is %s string 2\n", tmp );
/* Case insensitive (could use equivalent _stricmp) */
result = _stricmp( string1, string2 );
if( result > 0 )
strcpy( tmp, "greater than" );
else if( result < 0 )
strcpy( tmp, "less than" );
else
strcpy( tmp, "equal to" );
printf( "\t_stricmp: String 1 is %s string 2\n", tmp );
}
Output
Compare strings:
The quick brown dog jumps over the lazy fox
The QUICK brown dog jumps over the lazy fox
strcmp: String 1 is greater than string 2
_stricmp: String 1 is equal to string 2
String Manipulation Routines
See Also memcmp, _memicmp, strcoll Functions, _stricmp, strncmp, _strnicmp, strrchr, strspn, strxfrm