http://www.sendspace.com/file/g0v6po


thats my little code. When I execute it it gives me error..which it shouldnt.


the ls is called, its result is stored in fd[1], and the second child less reads the answer from fd[0] ...


its not working..anything wrong with close methods sthg..plz help

This problem isn't necessarily intuitive, but can be solved by looking at how shells handle pipelines: they exec the last things in the pipe first. Unlike human society, unix/linux/posix speakers (writers) suffer a horrible fate if they speak when there are no listeners (readers) unless, of course, the speakers (writers) are using tape delay (writing to disk).

Don't you just love metaphors? :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.