|
-
May 8th, 2010, 09:51 AM
#11
Re: Array of CString in VC++ 8?
 Originally Posted by openmp2000
Also, this array is used by many other functions or even other external projects so I can't change it to CStringArray or other forms.
CStringArray has been available since the beginning of MFC, so why didn't you use it to begin with? Did you not see in the MSDN documentation about CStringArray when you developed for VC 6?
Secondly, I have heard the excuse many times of "I can't change to using X because I have a lot of code". Personally, I have had to maintain applications that have hundreds of thousands of lines. Changing from one type to usage of another, and especially in the case such as you speak of, the change took less than a day.
All you have to do is just change the definition of one of your "main" variables from your home-made array to CStringArray. Then you recompile the source code and fix the compiler errors. Once the errors are fixed, the program shoud work as it always did after a round of tests. Sometimes, the change in source code is a simple search and replace, other times it is search and replace, with some changes in the source code to handle the new type (and the change is usually for the better -- the change usually shortens the code and makes it easier to maintain).
And lastly, even if you did want to make your own dynamic array of CString, it would look nothing like what you posted. Coding dynamic arrays, while error-prone, is still simple in concept, much more simple than your current code describes.
Regards,
Paul McKenzie
Last edited by Paul McKenzie; May 8th, 2010 at 09:54 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|