我有一個非常簡單的程序,讀取一個文件包含文本:Xcode中給出了不同的輸出,在每個時間(但不正確的輸出)
start
costam
stop
的程序是:
#include <iostream>
#include <fstream>
using namespace std;
int main (int argc, const char * argv[])
{
printf("init\n");
char c = NULL;
ifstream file;
file.open(argv[1]);
while (file.good()){
c = file.get();
printf("%c", c);
}
return 0;
}
Xcode的構建初始化從控制檯提供了:
init
start
costam
stop?
但Xcode的控制檯給我:
init
或
init
start
或
init
start
costam
或有時什麼也沒有。它沒有模式。我使用的是雪豹和Xcode 4.2
謝謝你。它解決了整個問題。但這真的很奇怪。 – user2207925 2013-03-25 15:05:50
@ user2207925我很驚訝。 – john 2013-03-25 15:19:58