I'm working on an existing program and I see several uses of a curious bit of code:
gridCharsSeen->Add(new char[ strlen(gridChars) ]);
strcpy((*gridCharsSeen)[Ze
ro], gridChars);
----
Now a few questions:
(1) Isnt this going to break, as the string needs one more byte for the ending zero byte?
(2) Would it not make more sense to have a method that does this, correctly, in one place,
rather than sixteen separate occurrences of these two lines?
Start Free Trial