在競賽中,我們常常需要比較我們寫的程序的輸出與樣例的差別,通常情況下是可以用肉眼觀察的到結果的。但是如果輸出極其之多或者是差一個空格回車之類的那咱們不就沒招了。
不,我們有fc命令,這是微軟給我們留下的不錯的東西,使用簡單方便快捷,還可以用來裝逼
這裡是它的APIs:
Compares two files or sets of files and displays the differences between them
FC [/A] [/C] [/L] [/LBn] [/N] [/OFF[LINE]] [/T] [/U] [/W] [/nnnn]
[drive1:][path1]filename1 [drive2:][path2]filename2
FC /B [drive1:][path1]filename1 [drive2:][path2]filename2
/A Displays only first and last lines for each set of differences.
/B Performs a binary comparison.
/C Disregards the case of letters.
/L Compares files as ASCII text.
/LBn Sets the maximum consecutive mismatches to the specified
number of lines.
/N Displays the line numbers on an ASCII comparison.
/OFF[LINE] Do not skip files with offline attribute set.
/T Does not expand tabs to spaces.
/U Compare files as UNICODE text files.
/W Compresses white space (tabs and spaces) for comparison.
/nnnn Specifies the number of consecutive lines that must match
after a mismatch.
[drive1:][path1]filename1 Specifies the first file or set of files to compare.
[drive2:][path2]filename2 Specifies the second file or set of files to compare.
然後咱們準備兩個內容有點不同的txt文檔
輸入fc out1.txt out2.txt
這時在終端上就可以看到結果了
如果比對信息太多了,還能輸出到文件里
輸入fc out1.txt out2.txt > isAC.txt
easy