mImoto
Full Member level 4
C++ questions?
Hello,
I have developed a Visual C++ 6.0 program. I would like to ask you some questions. I am learning Visual C++ and I am quite newbie.
In my program I read lines from a file. I use static memory allocation.
Cline is a class created by me.
CLine ArrayData[1000]; // Here 1000 is the nunber of lines of the file
// I don't know the nunber but I expect to be less than 1000.
char Data[1000][16];
// Here the 1000 is for the same reason but the 16 is fixed
I know that maybe this is not the optimun solution (I reserve probably more memory than I use) and it seems more C than C++.
I was wondering in using instead dynamic memory management but I don't know how to do it. I have also thought in using the "vector" class but I think is only for unidimensional arrays¿?.
The question is ¿How you experts do these?. It is better to use dynamic memory?. And is it possible to declare a vector of my Class CLinea or the types in vector are only int, etc?.
Thanks a lot and sorry for hitting you with so many questions,
Best regards,
mimoto
Hello,
I have developed a Visual C++ 6.0 program. I would like to ask you some questions. I am learning Visual C++ and I am quite newbie.
In my program I read lines from a file. I use static memory allocation.
Cline is a class created by me.
CLine ArrayData[1000]; // Here 1000 is the nunber of lines of the file
// I don't know the nunber but I expect to be less than 1000.
char Data[1000][16];
// Here the 1000 is for the same reason but the 16 is fixed
I know that maybe this is not the optimun solution (I reserve probably more memory than I use) and it seems more C than C++.
I was wondering in using instead dynamic memory management but I don't know how to do it. I have also thought in using the "vector" class but I think is only for unidimensional arrays¿?.
The question is ¿How you experts do these?. It is better to use dynamic memory?. And is it possible to declare a vector of my Class CLinea or the types in vector are only int, etc?.
Thanks a lot and sorry for hitting you with so many questions,
Best regards,
mimoto