Now I have a function const char *get_string(size_t maxlen) where the significant part according to this problem is like
in main() I have
char *s = new char[str.size()+1];
/* Copy the vector to passed string */
for(size_t i = 0; i < str.size(); i++)
s[i] = str[i];
s[str.size()] = '\0';
There must be something wrong in the upper code 'cause if, in main(), I set s to NULL nothing seems to happen. What's going on?