home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.lang.c:12880 comp.unix.programmer:4469
- Newsgroups: comp.lang.c,comp.unix.programmer
- Path: sparky!uunet!email!hp
- From: hp@vmars.tuwien.ac.at (Peter Holzer)
- Subject: Re: I/O With Unix/C
- Message-ID: <1992Aug27.190227.12940@email.tuwien.ac.at>
- Sender: news@email.tuwien.ac.at
- Nntp-Posting-Host: quasi.vmars.tuwien.ac.at
- Organization: Technical University Vienna, Dept. for Realtime Systems, AUSTRIA
- References: <ZcB7PB1w164w@underg.UUCP>
- Date: Thu, 27 Aug 1992 19:02:27 GMT
- Lines: 38
-
- max@underg.UUCP (Max Cray) writes:
-
- >I am trying to do the most basic file I/O on a couple of unix machines (HP835,
- >and Sequent S27), and I can not get it to work. For example:
-
- >#include <stdio.h>
- >main()
- >{
- > int c;
-
- > while (c = getchar() != NULL)
- > putchar(c);
- >}
-
- >On a DOS machine you just compile it, and it works.
-
- I very much doubt that. Your program contains 2 serious bugs. Firstly,
- it will not stop at EOF but after the first NUL character it receives
- (i.e. probably never). And it will print a character '\1' for every
- character it receives (And '\1' is non-printing on many systems, so you
- probably won't see anything).
-
- >When I compile it on
- >a unix machine, it compiles and runs, but I can't seem to redirect input
- >and output through it.
-
- >ls -l | myfilter > outfile.tmp
-
- >If I type the following command it runs, but it still expects the I/O to
- >come from the keyboard, and go to the screen.
-
- How large was outfile.tmp after you killed the program?
-
- --
- | _ | Peter J. Holzer | Think of it |
- | |_|_) | Technical University Vienna | as evolution |
- | | | | Dept. for Real-Time Systems | in action! |
- | __/ | hp@vmars.tuwien.ac.at | Tony Rand |
-