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?

Recommended Answers

All 5 Replies

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.

   char a[300];
   printf("A=%s \n",a);
   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, learning, and sharing knowledge.