Well, after searching for vectors outside of the tutorial, I got it to work. Thanks again. The tutorial only mentioned declaring array with dynamic memory allocation using
new, which would probably also work if my understanding of pointers (especially multidimensional ones) would be some better.
To overcome this, can you tell me if the following declaration would have correctly lead to a 2D-array of strings?
1 2 3 4 5
|
string **cells;
*cells= new string* [nline];
for (i= 0; i<nline; i++)
{ cells[i]= new string [ncolumn];
}
|
I quess something with the declaration of the dimension sizes would not be working here.
Another problem came up after using vectors: after reading out the cells of my csv-file to a vector of vectors of strings, I tried to convert those strings to double. I did this before with
strtod(...) with getting a kind of error value if the string cannot be converted to double (which is important for me). Now if I use an element of my new vector of vectors as first argument of
strtod my compiler gives the following error message:
|61|error: cannot convert 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >' to 'const char*' for argument '1' to 'double strtod(const char*, char**)'|
|
Since - as I think - this is touching again my bad understanding of pointers, I don't know how to overcome this problem.
Can you help me?
Thank you again,
Thommi.