一个关于c++的问题

我现在想在c++代码里把代码保存到文件里,举个例子,假如说我要把msgbox("a")这行代码保存到1.vbs里,但是我直接

fstream o;
o.open("1.Vbs",ios::out);
o<<"msgbox("a")";
o.close();

这样写会报错
有没有解决方法

使用c++11的原始字面量。https://blog.csdn.net/BostonRayAlen/article/details/118335987
在linux中这样编译

g++ a.cpp -o a -std=c++11
#include<iostream>
#include<fstream>
#include<sstream>
#include<string>

using namespace std;

int main()
{
        string content = R"(msgbox("a"))";
        //输出,写操作;
        ofstream writeFile("1.vbs",ios::app);
        if(writeFile.is_open())
        {
                writeFile<<content;
                writeFile.close();
        }
      
}

另外补充这几个打开方式
//ios::app:   以追加的方式打开文件
//ios::ate:   文件打开后定位到文件尾,ios:app就包含有此属性
//ios::binary:  以二进制方式打开文件,缺省的方式是文本方式
//ios::in:    文件以输入方式打开
//ios::out:   文件以输出方式打开
//ios::nocreate: 不建立文件,所以文件不存在时打开失败 
//ios::noreplace:不覆盖文件,所以打开文件时如果文件存在失败
//ios::trunc:  如果文件存在,把文件长度设为0


o<<"msgbox(\"a\")";