每次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);
经过测试,效果是这样的!
本文共 235 字,大约阅读时间需要 1 分钟。
每次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);
经过测试,效果是这样的!
转载地址:http://tkwnl.baihongyu.com/