Xref: utzoo comp.unix.questions:31749 comp.unix.programmer:1933 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!emory!wa4mei!holos0!lbr From: lbr@holos0.uucp (Len Reed) Newsgroups: comp.unix.questions,comp.unix.programmer Subject: Re: How do I tell if STDIN is a PIPE? Message-ID: <1991May28.172456.1585@holos0.uucp> Date: 28 May 91 17:24:56 GMT References: <1991May26.172328.713@arizona.edu> Distribution: world,local Organization: Holos Software, Inc., Atlanta, GA Lines: 23 In article <1991May26.172328.713@arizona.edu> jjr@ace.ece.arizona.edu (Jeffrey J. Rodriguez) writes: >How do I tell whether stdin is coming from a pipe? Use isapipe(0). >My problem is that lseek & fseek won't work with a pipe. Sure, but if you could check the error return from lseek. The isapipe() routine is cleaner, though. >If stdin is coming from a pipe, then what is the best way to do a seek? You can't. :-) >If the input data is not ASCII, then a loop of getchar() won't work. You are asking how can you move forward in the file from the current point. So who says getchar() won't work? It'll read binary bytes with no problem. -- Len Reed Holos Software, Inc. Voice: (404) 496-1358 UUCP: ...!gatech!holos0!lbr