Signal EOF in mac osx terminal
问题 I am stumped by the 1.5.2 question in K&R. I googled for sometime and found out that i have to supply the EOF input after entering the characters. long nc = 0; while (getchar() != EOF) ++nc; printf("%ld\n", nc); return 0; I tried both commnad-D and control-D as EOF inputs but nothing worked. Any Idea how to supply the EOF for mac osx? 回答1: By default, macOS (OS X [formerly Mac OS X]) terminals recognize EOF when Ctrl-D is pressed at the beginning of a line. In detail, the actual operation is