F
Frank Liebelt
Hi
I hope my english ist good enough to explain what my problem is.
I want to create a array with two dimensions. Each index should have a
second dimension with three indexes.
Like: myarr[0][0-2] , myarr[1][0-2] and so on...
The size of the first dimension is unknown the second ist allways three.
In Detail:
I read an XML File and save all Values in an char* Array:
I tried to use a vector for this problem.
Within the headerfile i wrote: vector<char> arrSpec;
....
int listPos = -1;
// This resize works
arrSpec.resize(XMLCount)
while ( element ) {
char *id = NULL;
char *name = NULL;
char *path = NULL;
listPos++;
id = xmlGetAttribute(element, _id);
name = xmlGetAttribute(element, _name);
path = xmlGetAttribute(element, _path
arrSpec[listPos].resize(3);
arrSpec[listPos][0].push_back(id);
arrSpec[listPos][1].push_back(name);
arrSpec[listPos][2].push_back(path);
....
Now the Problem.
-> arrSpec[listPos].resize(3);
Wont work. I got the following compiler error:
---
test.cpp:222: error: request for member `resize' in `(((std::vector<char,
std::allocator<char> >*)((TestClass*)this)) + 68u)->std::vector<_Tp,
_Alloc>:perator[] [with _Tp = char, _Alloc = std::allocator<char>]
(((unsigned int)listPos))', which is of non-class type `char'
---
The next three line have this compiler error:
invalid types `char[int]' for array subscript
I think this is cause the resize faild. But not sure.
So i need any help to get this done.
Frank
I hope my english ist good enough to explain what my problem is.
I want to create a array with two dimensions. Each index should have a
second dimension with three indexes.
Like: myarr[0][0-2] , myarr[1][0-2] and so on...
The size of the first dimension is unknown the second ist allways three.
In Detail:
I read an XML File and save all Values in an char* Array:
I tried to use a vector for this problem.
Within the headerfile i wrote: vector<char> arrSpec;
....
int listPos = -1;
// This resize works
arrSpec.resize(XMLCount)
while ( element ) {
char *id = NULL;
char *name = NULL;
char *path = NULL;
listPos++;
id = xmlGetAttribute(element, _id);
name = xmlGetAttribute(element, _name);
path = xmlGetAttribute(element, _path
arrSpec[listPos].resize(3);
arrSpec[listPos][0].push_back(id);
arrSpec[listPos][1].push_back(name);
arrSpec[listPos][2].push_back(path);
....
Now the Problem.
-> arrSpec[listPos].resize(3);
Wont work. I got the following compiler error:
---
test.cpp:222: error: request for member `resize' in `(((std::vector<char,
std::allocator<char> >*)((TestClass*)this)) + 68u)->std::vector<_Tp,
_Alloc>:perator[] [with _Tp = char, _Alloc = std::allocator<char>]
(((unsigned int)listPos))', which is of non-class type `char'
---
The next three line have this compiler error:
invalid types `char[int]' for array subscript
I think this is cause the resize faild. But not sure.
So i need any help to get this done.
Frank