读入txt问题

每次close之后,想继续读入而不擦除原来的内容,可以这样写:

ofstream area_file ("area.txt",ios::app|ios::out|ios::in);

 而每次均要擦除,这样写:

ofstream area_file ("area.txt",ios::trunc|ios::out|ios::in);
ofstream area_file ("area.txt",ios::ate|ios::out|ios::in);

 经过测试,效果是这样的!

 

posted @ 2012-03-21 08:50  hailong  阅读(201)  评论(0编辑  收藏  举报