I am a very new beginner so please excuse my ignorance.
I literally started learning c++ 3 days ago.
I am attempting to read a file and split each line into 2 arrays.
The first half the line is just text and i would like to store it for re-output in an of array.
The arrays has to vary in size depending on information passed to the program.
string **name;
name = new string*[atoms];
for (int i=0;i<atoms;i++){
name[i]=new string[8];
}
...
while (getline(coordsfile,line)){
size_t i = line.find("\t");
if (i != string::npos){
size_t y=0;
if (!line.empty()){
string first="";
string second="";
while (y!=i){
first += line[y++];
}
name[y] = first;
...
When I try to compile I get the following error.
rotation.cpp(97): error: no suitable conversion function from "std::string" to "std::string *" exists.
What is the differnence between these data types?
How can I make the conversion?
Please let me know if you need any more of my code. I tired to keep it uncluttered.