Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!unix.cis.pitt.edu!pitt!willett!ForthNet From: ForthNet@willett.pgh.pa.us (ForthNet articles from GEnie) Newsgroups: comp.lang.forth Subject: Forth vs C Message-ID: <2035.UUL1.3#5129@willett.pgh.pa.us> Date: 2 Dec 90 16:59:32 GMT Organization: String, Scotch tape, and Paperclips. (in Pgh, PA) Lines: 31 Category 2, Topic 14 Message 4 Sun Dec 02, 1990 NMORGENSTERN at 11:45 EST How to determine if a file exists without the overhead of opening it. It calls function 43H which gets the attribute flag using the general-duty DOS call HDOS1. : NonExistent? ( h -- f) \ 0= ok, 2= file not found, 3= path not found >nam 0 swap 17152 \ 4300 hex gets file attribute hdos1 \ atr 0 | code 1 0= if drop 0 then ; \ We don't really want attribute I am looking for a better name for this word. I was all wrong about the Abort Retry etc message. I mistakenly thought that it did not occur when you called file functions directly via int 21H. You can bypass this if you are expert enough. Int 24H returns the address of the Critical Error Handler routine. It is set to the Abort Retry etc routine. I am reminded of the riddle: How do porcupines have sex? Answer: Carefullly However you can test for such problems as door open, etc. by calling INT 25H which is absolute disk read. It attempts to read 1 sector into PAD, and returns an error flag. Drive is 0 for A: 1 for B: etc. Flag is 0 if ok. 2 is drive not ready. See DOS manual for other codes. code DriveError? ( drive -- f) pop ax xor ah, ah mov cx, # 1 xor dx, dx mov bx, # pad int 37 xor ah, ah 1push end-code. ----- This message came from GEnie via willett through a semi-automated process. Report problems to: dwp@willett.pgh.pa.us or uunet!willett!dwp Brought to you by Super Global Mega Corp .com