template <class T>
void savetext(T *a, char const *b) //writes to text file inside .sln however the text file is corrupt
{
ofstream fout(b, ios::out);
for (int i = 0; a[i] != '\0'; i++)
我想在C++中打开一个位图文件,改变它,然后创建另一个位图文件。问题是当我尝试使用ofstream输出位图文件时,即使不更改文件的任何字节,它也有一个奇怪的输出。 #include <fstream>
using namespace std;
int main()
{
ifstream fin ("6.bmp", std::ios::binary);
ofstream
我无法使用ofstream一次性向两个不同的文件写入两个不同的输出。该程序编译和运行良好,并p1output.txt写入数据,但是当我打开p2output.txt,它除了与内容的第一行空白: Time x1 x2 v1 v2 Energy Angular Momentum
如果我删除的代码将数据写入p1output.txt上的行程序正确写入数据到p2output.txt。我能想到的唯一的事情是