Originally Posted by gfzhang However, recommends you to use ofstream like this: Code: ofstream foutmaster; foutmaster.open("master.data", ... ); .......... foutmaster.close(); why? Why not just his: Code: ofstream foutmaster("master.data", ... ); // read data, etc. // when goes out of scope, it will close file automatically.
ofstream foutmaster; foutmaster.open("master.data", ... ); .......... foutmaster.close();
ofstream foutmaster("master.data", ... ); // read data, etc. // when goes out of scope, it will close file automatically.
Forum Rules