[net.micro.pc] WANTED -- DeSmet C Help.

jeff@ucf-cs.UUCP (Jeff Glover) (06/23/84)

[]

I need a way to get a pointer to a file's FCB in DeSmet C.  Does anyone
have a routine, or a partial routine, or even an idea of where I should
go looking for information?

The intended application is to look up the file size, as well as other
information about an open file.  No, DeSmet does not have the stat() call.
Thanks in advance.

-- 
Jeff C. Glover				      xx             .xx    .xx 
P.O. Box 26378				     ,MP            dM'"   dM'" 
Orlando, FL  32816			     dM'  ,g##Mg, #MMP#I #MMP#I 
(305)-275-4130				    ,MP  dM|""'MM  jMI    jMI   
					MM  jMI  MM""""="  MM     MM    
					`M#+#'   '##gg+#' |M|    |M|    

					{duke|decvax}!ucf-cs!jeff

broehl@wateng.UUCP (Bernie Roehl) (06/29/84)

Yes, you can do the equivalent of a stat() on files from DeSmet.
There are various approaches, depending on what information you need.

The following is one possible approach:
		struct
			{
			char reserved[21];
			char attr;
			unsigned ftime;
			unsigned fdate;
			long fsize;
			char fname[13];
			} dta;

		_os(0x1A, dta);	/* set up the disk transfer area */
		_os(0x4E, "frodo.txt");

The second _os() call does a "Find First", which fills the dta with infor-
mation about the first file matching the pattern given by the string.
(Yes, you can use wildcard characters).  Subsequent _os() calls using 4F
instead of 4E will return info about additional files matching the pattern.

HOWEVER, the use of _os() for this is tricky, since the DOS 2.00 manual says
(on page D-49, under the 0x4E call description) that CX contains an attribute
byte, and that only files mathcing that attribute will be found.  Thus a
safer way of doing it is to replace the second _os() call above with the
following:

		_rax = 0x4F00;
		_rcx = 0x0010;/* the 1-bit indicates directories are ok too */
		_rdx = "frodo.txt";
		_rds = _showds();
		_doint(0x21);	/* invoke DOS */

This requires (a) that you have release 2.3 (2.2?) or above of DeSmet (i.e.
that you have the _doint() function, and (b) that you have previously
declared the following:

		extern unsigned _rax, _rcx, _rdx, _rds;

The variable _carryf can be used to determine if there were any problems.
Have fun!
			

-- 
        -Bernie Roehl    (University of Waterloo)
	...decvax!allegra!watmath!watrose!wateng!broehl