Hello,

My problem is like that when I scan the data using fgets function and after I put fflush function but compiler not
wait for taking a data and it is directly go in next value scan.How to solve my program?

Hey Friends solve my issue.

Post the code that you have, it saves us all from playing guessing games.

Sometime compiler not wait for taking input from 1st fgets function.
And it skipped it.
I put fflush(stdin) after fgets function but still it is not working.
I have used multiple time fgets function in my program,so how to solve this problem.
Give suggetion.

#include<stdio.h>
main()
{
   char a[300];
   fgets(a,300,stdin);
   printf("A=%s \n",a);
   fgets(a,300,stdin);
   printf("B=%s \n",a);
}

Works fine for me. What compiler are you using, and how are you running it?

What compiler are you using, and how are you running it?

For what it's worth, I'll put my money on Turbo C; that typeless main whispers it.

Also works as expected here using GCC 4.8.2 20140206 (prerelease).

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.