#include<iostream>
#include<conio.h>
#include<fstream>
#include<string>
#include<string.h>
#include<vector>
using namespace std;
void main()
{
string read;
string name;
vector<string> myvec;
const char * word;
ifstream in;
in.open("w.txt");
ofstream out;
getline(in,read);
word = strtok(&read[0],",");
while(word != NULL)
{
name = word;
cout<<"Word: "<<word<<endl;
name = name + ".txt";
myvec.push_back(name);
out.open(name);
cout<<"Name: "<<name<<endl;
word = strtok(NULL,",");
out.close();
}
in.close();
system("pause");
}
The problem I am having is when i run it in ubuntu terminal it throws an error, which generally says that out.open() will not take string name.
I have to create different files taking input from a file. So is there a way to resolve the issue?