My Profile
Active Members
TodayLast 7 Days
more...
Awards & Gifts
Online Exams
Fresher Jobs
Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian
cities including Bangalore, Chennai, Hyderabad, Pune or Kochi
Resources
Find educational articles, blogs, discussion threads and other resources.
Colleges
Find details about any college in India or search for courses.
|
C QUESTIONS ON STDIO HEADER FILE(SECTION-8)
Posted Date: 27 Apr 2008 Resource Type: Articles/Knowledge Sharing Category: Jobs & Interviews
|
Posted By: umang garg Member Level: Gold Rating: Points: 5
|
|
|
|
78. Why does errno contain ENOTTY after a call to printf?
A: Many implementations of the stdio package adjust their behavior slightly if stdout is a terminal. To make the determination, these implementations perform an operation which fails (with ENOTTY) if stdout is not a terminal. Although the output operation goes on to complete successfully, errno still contains ENOTTY.
Reference: CT&P Sec. 5.4 p. 73.
79. My program's prompts and intermediate output don't always show up on the screen, especially when I pipe the output through another program.
A: It is best to use an explicit fflush(stdout) whenever output should definitely be visible. Several mechanisms attempt to perform the fflush for you, at the "right time," but they tend to apply only when stdout is a terminal. (See question 78.)
80. When I read from the keyboard with scanf(), it seems to hang until I type one extra line of input.
A: scanf() was designed for free-format input, which is seldom what you want when reading from the keyboard. In particular, "\n" in a format string means, not to expect a newline, but to read and discard characters as long as each is a whitespace character.
It is usually better to fgets() to read a whole line, and then use sscanf() or other string functions to parse the line buffer.
81. How can I recover the file name given an open file descriptor?
A: This problem is, in general, insoluble. Under Unix, for instance, a scan of the entire disk, (perhaps requiring special permissions) would theoretically be required, and would fail if the file descriptor was a pipe or referred to a deleted file (and could give a misleading answer for a file with multiple links). It is best to remember the names of open files yourself (perhaps with a wrapper function around fopen).
|
Responses
|
| Author: umang garg 27 Apr 2008 | Member Level: Gold Points : 2 | THESE ARE VERY GOOD QUESTION OF C LANGUAGE ON A TOPIC HEADER FILE(STDIO).THESE ARE QUESTION AND ANSWER WHICH WAS DEVELOPED BY SPECIALLIST OF C LANGUAGE AND IT MY ASSURANCE TO YOU THAT IF YOU GO THROUGH THESE QUESTION THEN YOU REALLY MAKE A ANSWER TO YOU RECRUITER ON TOPIC OF HEADER FILE ON STDIO.
|
|
Watch TV Channels
Watch Asianet TV onlineKairali TV in InternetSurya TV onlineAmritha TV Channel
|