ios::ate in gcc3.4.2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, I have question on using ios::ate in fstream

the source as following

#include <iostream.h>
#include <fstream.h>

int
main()
{
    fstream f;
    f.open("1", ios::out | ios::ate);
    f.seekp(0, ios::end);
    f << "Haha";
    f.close();

    return 0;
}

The file '1' is existed in current directory, its' content is "Merry
Christmas!", I want to add some words in the file(here

is the end of file, but my purpose is adding words in the middle of
file), but when I open file with ios::out | ios::ate,

it will clear the origal content of file '1' as if I open it in
ios::out. This occured in gcc3.4.2, when I use gcc2.9.5, it works
rightly.

I don't know whether it is a bug in gcc3.4.2 or I use it in wrong way.

Merry Christmas!

-- 
Best Wish with You!
			Li Qihong
China Integrated Circuit Design Center
Address: No.1 Gaojiayuan,Chaoyang District,Beijing,China.
Postcode: 100015 P.O.Box 8545
Tel: (86-10)64365577-2104
Email: liqh@xxxxxxxxxx

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux