Re: File handling
- Posted by Terry Constant <constant at FLASH.NET> Jun 07, 1998
- 531 views
Irv wrote: > > I tried the interrupt routine below, but it doesn't work. > Why? My guess is because the errorlevel code is destroyed > by the first call to errorlevel. > Perhaps system() is using (therefore destroying) it before > returning? Only Rob can tell us. > On the other hand, maybe something is wrong with my interrupt > routine. I don't know much about writing these. > > include machine.e > sequence reg_list -- list of register values > > function ErrorLevel() > reg_list = repeat(0, 10) > reg_list[REG_AX] = #4D00 -- function: get ERRORLEVEL > > reg_list = dos_interrupt(#21, reg_list) -- Call DOS interrupt #21 > return reg_list > end function > > ? ErrorLevel() > system("del test.xxx",2) > ? ErrorLevel() -- prints same as above, regardless of whether > -- the system call fails or succeeds. > Irv, Its been awhile since I worked with this stuff. But my first response to your "Why?" it doesn't work is that your first call to ErrorLevel() is to the shell (of Command.com) that the Euphoria program is in. The system() loads another shell, so any error codes generated by programs in that shell go there. By the time you get to your second call to ErrorLevel(), the shell is gone in which the error codes were generated and your second call is merely reading the same shell as the first call, that is the same info. -- Terry Constant constant at flash.net