Why do I get an exception when I pass a std::string to printf?
#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 cant understand why this produces an exception? This program mainly
tries to append strings. I get the desired output through COUT but not
through printf.
No comments:
Post a Comment