Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!sundc!sun!texsun!convex!mcomp!authorplaceholder From: wnp@mcomp.UUCP Newsgroups: comp.lang.c Subject: Re: Determining the names of device Message-ID: <155300012@mcomp> Date: Fri, 16-Oct-87 13:28:00 EDT Article-I.D.: mcomp.155300012 Posted: Fri Oct 16 13:28:00 1987 Date-Received: Mon, 19-Oct-87 00:35:31 EDT References: <122@nusdhub.UUCP> Lines: 36 Nf-ID: #R:nusdhub.UUCP:-12200:mcomp:155300012:000:1535 Nf-From: mcomp.UUCP!wnp Oct 16 12:28:00 1987 nusdhub.UUCP!rwhite (Robert White) writes: > In article <1801@killer.UUCP>, wnp@killer.UUCP (Wolf Paul) writes: > [Stuff Deleted] > > I find it interesting that apparently the MSC stat(2) function does not > > know how to distinguish between devices and regular files, whereas the > > fstat(2) function does make that distinction. I assume they use ioctl > > on the file handle passed to fstat. > > This is SOOOO.... Simple, that the methodologies described > above look quite convoluted.... > > 1) Get the "device status word" using ioctl against the open > file descriptor. [I don't remember the subcommand, so you'll > have to look it up] This is probably how the MSC fstat() function works. The difference between stat() and fstat() is that unlike fstat(), stat() is passed a FILENAME, not a file descriptor, and it is often undesirable to open the file within stat(), because some devices reset when you open them. That is why all these "convoluted methodologies" are of interest. If the matter is SOOOO simple, why does MS-C, which frequently demonstrates greater knowledge of DOS than is available to the public, not make the distinction between files and devices when using stat()? Wolf Paul -------------------------------------------------------- 3387 Sam Rayburn Run, Carrollton, TX 75007 UUCP: ihnp4!killer!wnp ihnp4!{killer, convex}!mcomp!wnp ihnp4!{killer, convex}!mcomp!dcs!wnp Work Phone: (214) 578-8023 Home Phone: (214) 306-9101 ESL: 6283-2882 TELEX/TWX: 910-380-0585