ofstream f;
char c;
f.close();
f.open(s.c_str(),ios::out);
if(f.is_open()) {
cout<<"Press <q> to save file";
char *text;
int count=0,count1;
while(1)
{ system("stty raw -echo");
cin>>c;
cout<<c;
system("stty cooked echo");
text[count]=c;
++count;
if(c=='q')
{
text[count]='\0';
while (text[count1]!='\0')
f.put(text[count1++]);
f.close();
break;
}
}
please help me out in this syntax i was not able to write data in file
Why this code gives segmentation fault
how i can resolve this problem