Вот упрощенное определение моего класса:
Код: Выделить всё
class CMyClass
{
private:
static const int MAX_Q = 10;
char* qvars[MAX_Q];
int vars_cnt; //count of strings
public:
CMyClass():vars_cnt(0)
{}
void add_text(const char* str);
void read();
};
Код: Выделить всё
void CMyClass::read()
{
const char* resQ = NULL;
resQ = GetTextResource(IDR_TEXT2);
char str[255] = ""; //buffer for each string
while (*resQ)
{
int j = 0;
while (*resQ != '\n' && *resQ != '\r' && j < 253)
str[j++] = *resQ++;
str[j++] = '\0'; //put a null character at the end of each line
if (strlen(str) > 0) //add a new line character if the line is not empty
strcat_s(str, sizeof(str), "\n");
*resQ++;
//then put str into an object using add_text() method
}
}
Код: Выделить всё
void CMyClass::add_text(const char* str)
{
if (vars_cnt >= MAX_Q)
{
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78701871/the-release-build-crashes-without-errors-on-start-exe-if-used-c-strings[/url]