M
Marco Costa
Hello all,
I wrote a simple ODBC wrapper class that used code like this ( not real
code, added types for clarification ):
char** type bufs = new char*[numberOfColumns]
for( int i = 0 ; i < numberOfColumns ; i++ ) {
size = getSizeOfColumn();
bufs = new char[sizeOfColumn+1];
BindBufferToColumn( bufs );
}
it worked as above, but when I tried to use a vector<char*> to simplify
the code like:
vector<char*> bufs;
for( int i = 0 ; i < numberOfColumns ; i++ ) {
size = getSizeOfColumn();
bufs.push_back(new char[sizeOfColumn+1]);
BindBufferToColumn( bufs );
}
Question is, does vector mess around with pointer addresses? should I
be using vector<char *const>?
I'd appreciate any insight.
Regards,
Marco
I wrote a simple ODBC wrapper class that used code like this ( not real
code, added types for clarification ):
char** type bufs = new char*[numberOfColumns]
for( int i = 0 ; i < numberOfColumns ; i++ ) {
size = getSizeOfColumn();
bufs = new char[sizeOfColumn+1];
BindBufferToColumn( bufs );
}
it worked as above, but when I tried to use a vector<char*> to simplify
the code like:
vector<char*> bufs;
for( int i = 0 ; i < numberOfColumns ; i++ ) {
size = getSizeOfColumn();
bufs.push_back(new char[sizeOfColumn+1]);
BindBufferToColumn( bufs );
}
Question is, does vector mess around with pointer addresses? should I
be using vector<char *const>?
I'd appreciate any insight.
Regards,
Marco