> I have attached .CPP file because it has long coding.
Step 1 is rename your source file to be say AzharProject.c
I figure you're trying to learn C, but what you posted will only compile with a C++ compiler.
2. Read -> SourceForge.net: cpwiki
fflush(stdin) and gets(foo) are BAD CODE.
3.
Code:
if (fdata== NULL)
{
puts("Unable to open the file");
main();
}
You have an awful lot of recursive calls to main for absolutely no good reason. Just return, like this
Code:
if (fdata== NULL)
{
puts("Unable to open the file");
return;
}
and put a "while" loop around all the code in main you want to repeat over and over until the user exits.
4. while( fread( &searchaccount, sizeof(*searchaccount), 1, fdata) )
Except searchaccount isn't the same size as your struct, so this will screw up badly.