Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!uunet!mcsun!hp4nl!star.cs.vu.nl!maart From: maart@cs.vu.nl (Maarten Litmaath) Newsgroups: comp.lang.c Subject: Re: Controlling stdin and stdouts of other executables Message-ID: <6492@star.cs.vu.nl> Date: 8 May 90 18:01:12 GMT References: <10765@shlump.nac.dec.com> <3967@hcx1.SSD.CSD.HARRIS.COM> <6418@star.cs.vu.nl> <4077@hcx1.SSD.CSD.HARRIS.COM> Sender: news@cs.vu.nl Reply-To: maart@cs.vu.nl (Maarten Litmaath) Organization: VU Informatika, Amsterdam, The Netherlands Lines: 37 In article <4077@hcx1.SSD.CSD.HARRIS.COM>, brad@SSD.CSD.HARRIS.COM (Brad Appleton) writes: )In article <6418@star.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: )... )>Bonus: the `0' in the execlp() call should be `(char *) 0'; grrrr, when )>do people ever learn? :-( ) )GRRRRRR yourself! I used it the way it was documented for my system!!!! The documentation is wrong. )I originally had used NULL (which is preferred over (char *) 0) instead of ^^^^^^^^^ Nonsense. )0 but My reference text used 0 (not (char * 0))! My system may be slightly )different than yours, but I did use the proper type according to my FM. ^^^^^^ The type of the bare `0' is not proper: you're relying on the compiler to turn it into the proper `(char *) 0'; you would be right to do so *iff* a complete prototype were in scope. The problem, however, is execlp() being a variadic function, hence the following incomplete prototype: extern int execlp(char *path, char *name, ...); There isn't a way to specify *every* argument of execlp() is to be a `char *'. Printf() on the other hand accepts arguments of various types (only the first must be a `char *'), yet its prototype looks quite the same: extern int printf(char *format, ...); )(Of course, it could be a problem in the FM :-) You bet. -- Antique fairy tale: Little Red Riding Hood. |Maarten Litmaath @ VU Amsterdam: Modern fairy tale: Oswald shot Kennedy. |maart@cs.vu.nl, uunet!cs.vu.nl!maart