String appending problems C++

Hello,
I'm using a program in wich in order to put characters on a output file, first I insert them in a string, so I can later put them in the file.

for example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
ofstream of;
string s;

while(...)
{
  s = "some info\n" + s;

  //Other operations
}

of.open("outputfile.txt");
of << s;
of.close()



Everything was going all right, but suddenly, without changing anything, it stopped working.

The problem is located on the concatenation of the string, since I've been debugging the program inserting displays before and after almost every line on the code.

The headers that I use for the program are:
1
2
3
4
5
6
#include <iostream>
#include <fstream>
#include <string>
#include <new>
#include <cstdlib>
#include <sstream> 


Thanks in advance for your attention, hope you can give any help.
There is no problem with the statement

s = "some info\n" + s;

So the problem is elsewhere in your code.
I know that the statement is correct, but when executing the program, it fails right there.
But the weirdest part is that it was working before, and it has stopped working.
What do you mean "fails right there"?
That means that the program stops running.
I'm working on Windows and with minGW for compilation.
closed account (o1vk4iN6)
Well first what did you change.
Topic archived. No new replies allowed.