Re: the mystery of <ctrl-d>



chandanlinster wrote:
/* if the program is executed as shown below:
* $./a.out
* ges<ctrl-d><ctrl-d>
*
* OUTPUT:
* Number of characters = 3
*
* Question: What happens to the first and second <ctrl-d>?
*/

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
int j;

for (j = 0; getchar() != EOF;j++)
;
fprintf(stdout, "Number of characters = %d\n", j);

exit(EXIT_SUCCESS);
}


Ok, I admit it! I stole them! I'm really sorry!!

Look, it's been a really really tough month, and I am seriously
behind on my ctrl-D's. My boss is chewing on my a**, and I have
all these TSP reports to do. I didn't think that anyone would
really miss them, so I took them, all right!

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
.



Relevant Pages

  • Re: How to convert Infix notation to postfix notation
    ... int intMaxLength) ... array of 15 characters, and you call this function with the limit 15 on ... int appendPolish(char *strPolish, char chrNext) ... give a message like "string too long". ...
    (comp.lang.c)
  • Re: Checking for a keypress on Linux ?????
    ... the short delay in kbhit() ... > int getch; ... > * returns the number of characters available to read. ... > static struct termios Otty, ...
    (comp.os.linux.development.apps)
  • Re: [PATCH] Fix console utf8 composing
    ... So, the result is that the result of the composing operation is still taken from the accent_table, and thus cannot be more than "unsigned char" allows. ... in UTF-8 mode, it is possible to generate characters from Latin-1 set by composing, and they are generated correctly. ... +static int use_unicode; ...
    (Linux-Kernel)
  • Re: K&R Exercise 1-21: entab
    ... abc     _def ... when the resultant spacing was ... int tabreplace ... You've got "abc", which is three characters, plus five ...
    (comp.lang.c)
  • Re: [PATCH] console UTF-8 fixes
    ... as substitute glyph ... don't ignore zero-width characters (except for a few zero-width spaces ... print an extra space for double-wide characters for the cursor to stand ... int first; ...
    (Linux-Kernel)