Code contains a structure which contains two data member mtype
and mtext
, MAXSIZE
is the maximum size of that variable. I want to insert data into mtext
. I have the code also, but I don,t know how scanf("%[^\n]",sbuf.mtext);
here is working. And if there is any other method to do so, then please tell me.
struct msgbuf{
long mtype;
char mtext[MAXSIZE];
}sbuf;
scanf("%[^\n]",sbuf.mtext);