Reputation: 1858
I have a problem with file handling. I'm writing code for file handling, that looks like this:
ofstream SaveFile("/home/core-site2.xml")
//SaveFile<<"<?xml version="1.0"?>" ;
SaveFile <<endl ;
SaveFile<<"<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>" ;
When I compile this file I get the following error:
error: expected ‘;’ before ‘text’
What shouuld I do to remove the error? How do I write these line properly?
Upvotes: 1
Views: 155
Reputation: 11149
SaveFile<<"<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?>" ;
You need to escape the quotes in the string. Otherwise the compiler thinks they are the end of the string.
Upvotes: 1
Reputation: 26772
The declaration of SaveFile misses a trailing ';'. Also, you need to escape the quotes inside the string:
SaveFile<<"<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?>" ;
Upvotes: 2
Reputation: 2516
ofstream SaveFile("/home/core-site2.xml");
and
SaveFile<<"<?xml-stylesheet type=\"text/xsl\" href=\"configuration.xsl\"?>" ;
Upvotes: 2
Reputation: 10839
You're missing a semi-colon from the end of your ofstream declaration.
Upvotes: 1
Reputation: 76778
ofstream SaveFile("/home/core-site2.xml")
This line lacks a semicolon.
Upvotes: 1