2026-27-cpp-homework/feladat4/feladat4/cmydateexception.cpp
2026-10-31 10:05:41 +01:00

31 lines
532 B
C++

//Tóth Dániel Mátyás | IFPQYY | V1
#include "cmydateexception.h"
static int CopyStr(char* dest, const char* src, const char* concat = "\0") {
if (dest == nullptr || src == nullptr) {
return -1;
}
int i = 0;
while (src[i] != '\0')
{
dest[i++] = src[i];
}
int j = 0;
while (concat[j] != '\0')
{
dest[i++] = concat[j++];
}
dest[i] = '\0';
return -1;
}
CMyDateException::CMyDateException(const char* s)
{
msg = new char[256];
CopyStr(msg, s);
}
const char* CMyDateException::what() const {
return msg;
}