i am working on a database basic project consider a structure
struct student
{
int rollno;
char full_name[20];
char address[50];
char birthmark[50];
};
how to take this input
rollno 6
name john snow
address winterfell of north
birthmark swords wound all over
What I have tried:
i have tried
scanf("%s",stringname)
,scanf("%[^\n]s",stringname)
,gets(stringname)
,
fgets(buffer,size,stdin)
with fflush(stdin)
.
there are always some error.
so far fgets work perfectly but I have read ffush(stdin)
is a wrong practice .
so what should be the approach to take input of string (with spaces) simultaneously one after the another.