我编写了一个脚本语言,并且正在编写一个程序,它将1:请求您的路径以读取脚本,并且2:将代码编译为自定义的十六进制数,并由另一个程序读取为我做艰苦的工作。我的问题是我无法创建一个新文件并将自定义的十六进制代码写入该文件。创建和编写文件C++
这里是我的代码示例:我希望它做一个新.whatevertheheckyouwanttocallit文件,并写入到它的工作文件
#include <iostream>
#include <string>
#include <Windows.h>
#include <wincon.h>
#include <fstream>;
using namespace std;
int main(){
string path;
string title;
cout << "Enter your path to compile your *.egSCRIPT file: ";
cin >> path;
cout << "Enter the title for the new file";
cin >> title;
ofstream myfile(path+"\\"+title+".myScriptLanguage");
myfile.open(path);
myfile << "IT WORKS!!!";
myfile.close();
return 0;
}
!只是一个样本。我最终将写入一个自定义的十六进制代码系统,供我的解释器读取。提前致谢。
你具体看到什么错误? – 2013-04-07 23:41:28
我没有错误。只是为了测试,我会写出路径,并且'应该'创建一个.wav文件并写到它上面它工作!!!。 – 2013-04-07 23:43:06
你的实际结果是?我不明白你的问题... – 2013-04-07 23:45:59