This is a very simple code. When I use two identical files (copy to get an identical copy), it always says "NOT identical". What is wrong? Thanks a lot. #include #include #include #include using namespace std; int main(int argc, char *argv[]) { ifstream fin1, fin2; fin1.open(argv[0]); fin2.open(argv[1]); char c1, c2; do { fin1.get(c1); fin2.get(c2); if(c1!=c2) { cout << "The two files are NOT identical." << endl;
【在 c**********e 的大作中提到】 : This is a very simple code. When I use two identical files (copy to get : an identical copy), it always says "NOT identical". : What is wrong? Thanks a lot. : #include : #include : #include : #include : using namespace std; : int main(int argc, char *argv[]) : {
^^^^^^^^^^^^^^^^^^^^^ should be argv[1] and argv[2] should be &c1 and &c2
【在 c**********e 的大作中提到】 : This is a very simple code. When I use two identical files (copy to get : an identical copy), it always says "NOT identical". : What is wrong? Thanks a lot. : #include : #include : #include : #include : using namespace std; : int main(int argc, char *argv[]) : {
z*0
8 楼
填写I-539就行了。
t*t
9 楼
我发现你老了...istream::get(char& c)...
【在 c*****t 的大作中提到】 : Two problems. thrust pointed out one : : ^^^^^^^^^^^^^^^^^^^^^ : should be argv[1] and argv[2] : should be &c1 and &c2