home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!murphy!dwrsun4!perl
- From: perl@dwrsun4.UUCP (Robert Perlberg)
- Newsgroups: comp.unix.misc
- Subject: Re: How to find the size of space being occupied in 1/4" cartridge tape?
- Message-ID: <2766@perl-sun.dwrsun4.UUCP>
- Date: 17 Jul 92 19:26:56 GMT
- References: <1992Jul10.065509.1197@mdd.comm.mot.com>
- Organization: Dean Witter Reynolds Inc., New York
- Lines: 24
-
- In article <1992Jul10.065509.1197@mdd.comm.mot.com>, to@mdd.comm.mot.com (Ricky To) writes:
- > I am trying to write a C program to find the size of space currently
- > being occupied by files in a 1/4" cartridge tape. ...
-
- > Unfortunately, this code does not work. The reason is that fscanf()
- > is not able to catch the error message. Could anybody suggest any
- > workarounds for this problem, or even another technique to find the
- > size of the space? Thanks in advance.
-
- Well, to catch the error messages use the "2>&1" shell operator, thus:
-
- fd = popen ("tar tvf /dev/nrst0 2>&1", "r");
-
- This merges stderr with stdout.
-
- Unless I'm missing something, couldn't you do this more easily with
- something like this?:
-
- dd if=/dev/nrst0 bs=126b | wc -c
-
- Robert Perlberg
- Dean Witter Reynolds Inc., New York
- {murphy | philabs}!dwrsun4!perl
- -- "I am not a language ... I am a free man!"
-