www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/03/21:24:06

Date: Tue, 3 Feb 1998 18:23:27 -0800 (PST)
Message-Id: <199802040223.SAA05062@adit.ap.net>
Mime-Version: 1.0
To: Nils Anders Danielsson <nils DOT anders AT swipnet DOT se>, djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: System crashing - system( "readme.txt" );

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019