in reply to Example for EOF

The majority of the time, using eof is a mistake.

What code have you written so far? If we had an example, someone could show you how to achieve what you want. (Please keep this in mind: it’s never a good idea to ask about a particular programming problem without posting any code.)

Makeshifts last the longest.