Subj : Re: Declaring a Dynamic String To : borland.public.cpp.borlandcpp,borland.public.cppbuilder.language.cpp From : DKat Date : Tue Nov 09 2004 11:57 am "Andrue Cope [TeamB]" wrote in message news:4190eb9c@newsgroups.borland.com... > DKat wrote: > >> So - does anyone have a clue what I'm trying to convey >> and how to deal with it properly? > > You could create a two dimensional array of AnsiStrings but the size > isn't fixed so you'd have to do that on the heap. That's perfectly > possible but a PITA. > > How about using std::vector? > > typedef std::vector ColumnOfAnsiStrings; > typedef std::vector GridOfAnsiStrings; > > WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) > { > GridOfAnsiStrings grid; > > for( int columnIndex=0; > columnIndex<10; > ++columnIndex ) > { > ColumnOfAnsiStrings column; > > for( int rowIndex=0; > rowIndex<10; > ++rowIndex ) > column.push_back( AnsiString( columnIndex )+ > ","+AnsiString( rowIndex ) ); > > grid.push_back( column ); > } > > ShowMessage( grid[ 5 ][ 6 ] ); // "5,6" > } > > -- > Andrue Cope [TeamB] > [Bicester, Uk] > http://info.borland.com/newsgroups/guide.html That is just beautiful! I have never seen a vector before and have nothing of them in my books. I will have to hunt it down so that I understand what it is that I'm doing but this is exactly what I want. Thank you! .