Mail Archives: djgpp/1998/02/03/21:24:06
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
- Raw text -