操做系統環境:Windows 7 6-bit,安裝mingw和msysios
有兩個文件,用cat命令看不出來區別:vim
D:\code\cxx>cat b.cpp c.cppwindows
#include <iostream>編輯器
using namespace std;spa
int操作系統
main(void)code
{it
cout << "aaaaabbbbb" << endl;io
return 0;編譯
}
#include <iostream>
using namespace std;
int
main(void)
{
cout << "aaaaabbbbb" << endl;
return 0;
}
D:\code\cxx>
可是用type命令就出現了區別:
D:\code\cxx>type b.cpp c.cpp
b.cpp
??
c.cpp
#include <iostream>
using namespace std;
int
main(void)
{
cout << "aaaaabbbbb" << endl;
return 0;
}
D:\code\cxx>
能夠看到對b.cpp文件,type命令沒法讀出其內容。
進一步,採用file命令查看文件屬性:
D:\code\cxx>file b.cpp c.cpp
b.cpp: Big-endian UTF-16 Unicode text, with CRLF line terminators
c.cpp: ASCII C program text, with CRLF line terminators
而後,咱們用mingw-g++編譯,對c.cpp沒有問題,一次即過。
可是對於b.cpp,編譯結果以下:
D:\code\cxx>g++ b.cpp
b.cpp:1:1: error: stray '\376' in program
b.cpp:1:1: error: stray '\377' in program
b.cpp:1:1: error: stray '\376' in program
b.cpp:1:1: error: stray '\377' in program
b.cpp:1:5: warning: null character(s) ignored [enabled by default]
b.cpp:1:1: error: stray '#' in program
b.cpp:1:7: warning: null character(s) ignored [enabled by default]
b.cpp:1:9: warning: null character(s) ignored [enabled by default]
b.cpp:1:11: warning: null character(s) ignored [enabled by default]
b.cpp:1:13: warning: null character(s) ignored [enabled by default]
b.cpp:1:15: warning: null character(s) ignored [enabled by default]
b.cpp:1:17: warning: null character(s) ignored [enabled by default]
b.cpp:1:19: warning: null character(s) ignored [enabled by default]
b.cpp:1:21: warning: null character(s) ignored [enabled by default]
b.cpp:1:25: warning: null character(s) ignored [enabled by default]
b.cpp:1:27: warning: null character(s) ignored [enabled by default]
b.cpp:1:29: warning: null character(s) ignored [enabled by default]
b.cpp:1:31: warning: null character(s) ignored [enabled by default]
b.cpp:1:33: warning: null character(s) ignored [enabled by default]
b.cpp:1:35: warning: null character(s) ignored [enabled by default]
b.cpp:1:37: warning: null character(s) ignored [enabled by default]
b.cpp:1:39: warning: null character(s) ignored [enabled by default]
b.cpp:1:41: warning: null character(s) ignored [enabled by default]
b.cpp:1:43: warning: null character(s) ignored [enabled by default]
b.cpp:2:1: warning: null character(s) ignored [enabled by default]
b.cpp:3:1: warning: null character(s) ignored [enabled by default]
b.cpp:3:3: warning: null character(s) ignored [enabled by default]
b.cpp:3:5: warning: null character(s) ignored [enabled by default]
b.cpp:3:7: warning: null character(s) ignored [enabled by default]
b.cpp:3:9: warning: null character(s) ignored [enabled by default]
b.cpp:3:11: warning: null character(s) ignored [enabled by default]
b.cpp:3:15: warning: null character(s) ignored [enabled by default]
b.cpp:3:17: warning: null character(s) ignored [enabled by default]
b.cpp:3:19: warning: null character(s) ignored [enabled by default]
b.cpp:3:21: warning: null character(s) ignored [enabled by default]
b.cpp:3:23: warning: null character(s) ignored [enabled by default]
b.cpp:3:25: warning: null character(s) ignored [enabled by default]
b.cpp:3:27: warning: null character(s) ignored [enabled by default]
b.cpp:3:29: warning: null character(s) ignored [enabled by default]
b.cpp:3:31: warning: null character(s) ignored [enabled by default]
b.cpp:3:35: warning: null character(s) ignored [enabled by default]
b.cpp:3:37: warning: null character(s) ignored [enabled by default]
b.cpp:3:39: warning: null character(s) ignored [enabled by default]
b.cpp:3:41: warning: null character(s) ignored [enabled by default]
b.cpp:4:1: warning: null character(s) ignored [enabled by default]
b.cpp:5:1: warning: null character(s) ignored [enabled by default]
b.cpp:6:1: warning: null character(s) ignored [enabled by default]
b.cpp:7:1: warning: null character(s) ignored [enabled by default]
b.cpp:7:3: warning: null character(s) ignored [enabled by default]
b.cpp:7:5: warning: null character(s) ignored [enabled by default]
b.cpp:7:7: warning: null character(s) ignored [enabled by default]
b.cpp:8:1: warning: null character(s) ignored [enabled by default]
b.cpp:9:1: warning: null character(s) ignored [enabled by default]
b.cpp:9:3: warning: null character(s) ignored [enabled by default]
b.cpp:9:5: warning: null character(s) ignored [enabled by default]
b.cpp:9:7: warning: null character(s) ignored [enabled by default]
b.cpp:9:9: warning: null character(s) ignored [enabled by default]
b.cpp:9:11: warning: null character(s) ignored [enabled by default]
b.cpp:9:13: warning: null character(s) ignored [enabled by default]
b.cpp:9:15: warning: null character(s) ignored [enabled by default]
b.cpp:9:17: warning: null character(s) ignored [enabled by default]
b.cpp:9:19: warning: null character(s) ignored [enabled by default]
b.cpp:9:21: warning: null character(s) ignored [enabled by default]
b.cpp:10:1: warning: null character(s) ignored [enabled by default]
b.cpp:11:1: warning: null character(s) ignored [enabled by default]
b.cpp:11:3: warning: null character(s) ignored [enabled by default]
b.cpp:12:1: warning: null character(s) ignored [enabled by default]
b.cpp:13:1: warning: null character(s) ignored [enabled by default]
b.cpp:13:11: warning: null character(s) ignored [enabled by default]
b.cpp:13:13: warning: null character(s) ignored [enabled by default]
b.cpp:13:15: warning: null character(s) ignored [enabled by default]
b.cpp:13:17: warning: null character(s) ignored [enabled by default]
b.cpp:13:21: warning: null character(s) ignored [enabled by default]
b.cpp:13:23: warning: null character(s) ignored [enabled by default]
b.cpp:13:26: warning: null character(s) preserved in literal [enabled by default]
b.cpp:13:49: warning: null character(s) ignored [enabled by default]
b.cpp:13:53: warning: null character(s) ignored [enabled by default]
b.cpp:13:55: warning: null character(s) ignored [enabled by default]
b.cpp:13:59: warning: null character(s) ignored [enabled by default]
b.cpp:13:61: warning: null character(s) ignored [enabled by default]
b.cpp:13:63: warning: null character(s) ignored [enabled by default]
b.cpp:13:65: warning: null character(s) ignored [enabled by default]
b.cpp:13:67: warning: null character(s) ignored [enabled by default]
b.cpp:14:1: warning: null character(s) ignored [enabled by default]
b.cpp:15:1: warning: null character(s) ignored [enabled by default]
b.cpp:15:11: warning: null character(s) ignored [enabled by default]
b.cpp:15:13: warning: null character(s) ignored [enabled by default]
b.cpp:15:15: warning: null character(s) ignored [enabled by default]
b.cpp:15:17: warning: null character(s) ignored [enabled by default]
b.cpp:15:19: warning: null character(s) ignored [enabled by default]
b.cpp:15:21: warning: null character(s) ignored [enabled by default]
b.cpp:15:25: warning: null character(s) ignored [enabled by default]
b.cpp:15:27: warning: null character(s) ignored [enabled by default]
b.cpp:16:1: warning: null character(s) ignored [enabled by default]
b.cpp:17:1: warning: null character(s) ignored [enabled by default]
b.cpp:17:3: warning: null character(s) ignored [enabled by default]
b.cpp:18:1: warning: null character(s) ignored [enabled by default]
b.cpp:1:8: error: 'i' does not name a type
b.cpp:7:2: error: 'i' does not name a type
D:\code\cxx>
對UTF-16文件格式沒有沒有研究過,先記錄下來。
順便說下兩個文件的編輯過程,
b.cpp,使用Windows 7自帶的Microsoft PowerShell ISE的腳本編輯器編輯;
c.cpp,使用gvim on windows編輯。