藍森林首頁 | 返回主頁 | 本站地圖 | 站內搜索 | 聯繫信箱 |
 您目前的位置:首頁 > 自由軟件 > 技術交流 > 應用編程


    

藍森林 http://www.lslnet.com 2006年6月6日 10:18


gcc or freebsd bug?

#include <stdio.h>;
#include <iostream>;
#include <fstream>;
using namespace std;

int main(int argc, char *argv[])
{

int nCount,total=0;
char buf[129];

fstream ff(argv[1],ios::in|ios::binary);

while((nCount =  ff.readsome(buf,128))>;0)
        {
        total+=nCount;
        }
printf("size: %d\n",total);
        return 0;
}

-----------------------------------------------

上面一段代碼 在linux編譯運行正常
但在freebsd 4.9/5.2下編譯後運行不正常..
顯示的文件大小不對, 是誰的bug? freebsd/gcc?

gcc or freebsd bug?

保存為 tfile.cpp

gcc -o tf tfile.cpp -lstdc++

ls -l tf
./tf tf

理論上應該是ls 的結果和程序的結果是一樣的, 但在fb下卻不一樣.why?

相同的編譯器版本,在linux下卻正常..

gcc or freebsd bug?

大家看看;)



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 藍森林網站 版權所有。 E-mail : webmaster@lslnet.com