Hello all,
Having a weird problem with joining some strings. Wondering if anyone could help.
Code:
#include <iostream>
#include <string.h>
#include <stdlib.h>
struct Configuration {
char *Nickname;
char *RealName;
};
struct Configuration Configuration;
int main() {
Configuration.RealName = "Test, from DaveHope";
Configuration.Nickname = "davehopetest";
char *tmp;
tmp = "USER "; // USER test localhost localhost :Test Bot\n\r";
strcat(tmp, Configuration.Nickname);
strcat(tmp, " localhost localhost :");
strcat(tmp, Configuration.RealName);
strcat(tmp, "\n\r");
printf(tmp);
return 0;
}
Even when compiled with -Wall, I still get no warnings. It seems to segfault on the strcat() stuff, no idea why. So, erm. Any help would be apprecated!