0

In windows I used to enter Ctrl+Z in cmd to mark the end of input to a C program. What is its equivalent key combination for Ubuntu terminal? Ctrl+D seems to terminate my program rather than to terminate the input.

Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79
Crazy-Fool
  • 96
  • 1
  • 13

1 Answers1

4

This depends on the implementation of the program. Ctrl+D writes EOF to stdin, so it's up to the programmer to decide what to do with that input.

Andrii Omelchenko
  • 13,183
  • 12
  • 43
  • 79
Henrik
  • 4,254
  • 15
  • 28
  • @Henrick Sorry for my noob question, but how to see the man page and what is it? – Crazy-Fool Jul 06 '14 at 08:03
  • I think the man page is irrelevant since the program in question is one he has written himself. If this were not the case the question has no place on SO. @AbhirupMondal - perhaps you should post your code too? – Clifford Jul 06 '14 at 08:17
  • @Clifford I didn't catch that - good point – Henrik Jul 06 '14 at 09:14
  • @Abhirup Never mind - I didn't catch that you were talking about your own program. – Henrik Jul 06 '14 at 09:15
  • 1
    Ctrl-D does not really “write EOF”, it flushes. (To handle ctrl-D, the OP should handle OEF, though.) http://stackoverflow.com/a/1516177/139746 – Pascal Cuoq Jul 06 '14 at 09:20