problems with ofstream outfile

So here is the problem.

I cant get this part ---> <svg width="100%" height="100%" version="1.1"
in here

ofstream outfile;
outfile.open("aa.svg",ofstream::out | ofstream::trunc);
outfile<<"<svg width="100%" height="100%" version="1.1""; <--- this part
outfile.close();

There are problems with theses =," and % signs. Can anyone help me?
You should use the \" escape character if you want a " in a string: "<svg width=\"100%\" height=\"100%\" version=\"1.1\""
Last edited on
The problem is that you have embedded quote symbols.

It's the same as going.
string s = "<svg width="100%" height="100%" version="1.1"";
How is the compiler suppose to know where your string starts and ends?

You need to escape your quote characters like:
"<svg width=\"100%\" height=\"100%\" version=\"1.1\"";

tnx its worked :)
Topic archived. No new replies allowed.