How CTRL+Z can be used to denote end of file:
main()
{
int c;
print("Enter the character (CTRL+Z to end):");
c=getchar();
if(c!=EOF)
printf("End of file not encountered ");
}
o/p:
Enter the character (CTRL+Z to end):d
End of file not encountered.
main()
{
int c;
print("Enter the character (CTRL+Z to end):");
c=getchar();
if(c!=EOF)
printf("End of file not encountered ");
}
o/p:
Enter the character (CTRL+Z to end):d
End of file not encountered.
No comments:
Post a Comment