Path: utzoo!attcan!uunet!ogicse!pdxgate!eecs!kirkenda From: kirkenda@eecs.cs.pdx.edu (Steve Kirkendall) Newsgroups: comp.os.os9 Subject: Re: Whats wrong with this picture Message-ID: <326@pdxgate.UUCP> Date: 13 Oct 90 15:29:27 GMT References: <1068@bcs800.UUCP> Sender: news@pdxgate.UUCP Reply-To: kirkenda@eecs.UUCP (Steve Kirkendall) Organization: Portland State University, Portland, OR Lines: 16 In article <1068@bcs800.UUCP> jeffr@bcs800.UUCP (Jeff Riegel) writes: > > if (fd = open(argv[1],1) < 0) { Your problem comes from the fact that the "<" operator has a higher precedence than the "=" operator, so that this line is parsed like this: if (fd = (open(argv[1],1) < 0)) { Which isn't right. If it opens the file successfully, then the fd will be set to "false", or 0. To have it parsed the way you want, try it this way instead: if ((fd = open(argv[1],1)) < 0) { ------------------------------------------------------------------------------- Steve Kirkendall kirkenda@cs.pdx.edu Grad student at Portland State U.