Hi
snprintf is working fine when i am not using append function . But as soon as i use append function snprintf crashes . Please suggest
why snprintf is crashing after append . What is special with append function which is crashing this program
Below is the program.
#include<string>
#include<iostream>
#include<conio.h>
using namespace std;
int main()
{
char *s;
string name="ESACPE ";
name.append("hello '\\' ");
cout<<snprintf(s,30,name.c_str());
getch();
return 0;
}
tom_jerry042 0 Newbie Poster
Salem 5,199 Posting Sage
ArkM 1,090 Postaholic
tom_jerry042 0 Newbie Poster
Salem 5,199 Posting Sage
tom_jerry042 0 Newbie Poster
iDeveloper 21 Light Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.