Re: Help on pipe
Glynn Clements <[email protected]>
| Newsgroups | org.kernel.vger.linux-c-programming |
|---|---|
| Message-ID | <[email protected]> |
Micha³ Nazarewicz wrote: > > waitpid(pid, &ret, 0); > > close(fds[1]); > > No need to close. There definitely is a need to close, but it should be fclose(stream) *before* the waitpid(). As David points out, sort won't terminate until it has finished reading its input. David Lee wrote: > The sort program is waiting for an EOF (^D). Ctrl-D isn't EOF unless you're reading from a terminal. The TTY driver "sends EOF" (i.e. causes read() to return a zero count) when you press Ctrl-D (by default) if the driver is in canonical mode. Ctrl-D doesn't have any significance in other contexts. -- Glynn Clements <[email protected]> -- To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html