#include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
int main()
{
char a[10] = "asd asd";
char b[10] ="bsd bsd";
string str(a);
str.append(b);
printf("\n--------%s--------\n", str);
return 0;
}
I can't understand why this produces an exception? This program mainly tries to append strings. I get the desired output when using std::cout
but not when using printf
.