delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/18/21:11:55

Date: Mon, 18 Jan 1999 21:11:29 -0500 (EST)
From: Daniel Reed <djr AT narnia DOT n DOT ml DOT org>
To: djgpp AT delorie DOT com
cc: koehler AT telik DOT com
Subject: Re: djgpp (dos) preproccessor directive
In-Reply-To: <koehlerF5s8Kz.M8q@netcom.com>
Message-ID: <Pine.LNX.4.05.9901182104190.27242-100000@narnia.n.ml.org>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com

On Tue, 19 Jan 1999, Koehler wrote:
) #ifdef _SOME_DJGPP_FLAG_?_
) 	system("del file.dos");
) #else
) 	system("rm file.unix");
) #endif
If you're only using system() for rm/del, why not simply use the remove()
C call?
	remove("file");
However, GCC will always #define unix when compiling under Linux/etc.*, so
you could use
#ifdef unix
	system("unix-centric command");
#else
	system("DOS-centric command");
#endif



* You can see what macros are predefined using the -dM argument to cpp, ie:
(21:09)root AT narnia:~# echo | cpp -dM
#define linux 1
#define __ELF__ 1
#define unix 1
(21:09)root AT narnia:~#

-- 
Daniel Reed <n AT ml DOT org>
Man will occasionally stumble over the truth, but most times he will pick himself up and carry on. -- Winston Churchill

- Raw text -


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