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?
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?
Jump to PostPost the code that you have, it saves us all from playing guessing games.
Jump to PostWorks fine for me. What compiler are you using, and how are you running it?
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).
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.
You're trying to visit a URL that doesn't currently exist on the web. Most likely, a member posted a link a long time ago to a web page that has since been removed. It's also possible that there was a typo when posting the URL. We redirect you to this notice instead of stripping out the link to preserve the integrity of the post.