Date: Tue, 3 Feb 1998 18:23:27 -0800 (PST) Message-Id: <199802040223.SAA05062@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: Nils Anders Danielsson , djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: System crashing - system( "readme.txt" ); Precedence: bulk At 06:55 2/3/1998 +0100, Nils Anders Danielsson wrote: >When I run a program with something like "system( "readme.txt" );" in >the code, the program crashes, both under Windows 95 and DOS 7. > >Why? It's a fairly complicated issue. There was a discussion about it (started by me, in fact) some months ago; search the archives for the thread "DJGPP runs bogus binaries". The root cause is that there is no way to identify a COM file except by its name. Anything which the `system'/`spawn' call can't otherwise identify is assumed to be a COM file and passed to DOS as such, which then loads it and jumps to the beginning. Obviously bad things happen if it isn't really a COM file. > >I'm writing a file manager with a command line function, and it's quite >difficult to check if what's written is "runnable" or not. You can use the function `_is_executable', although its use seems to be discouraged, or its higher-level interface `stat'. Nate Eldredge eldredge AT ap DOT net