Mail Archives: djgpp/1999/01/19/04:47:25
On Tue, 19 Jan 1999, Koehler wrote:
> I now need to differentiate between unix and dos (to differentiate
> system() calls of 'rm' and 'del') in one of my programs.
You could simply distribute the DJGPP port of `rm' with your program,
and thus eliminate the need for any change.
Another possibility is to produce the same effect by calling library
functions. For example, use `remove' instead of launching an external
program.
> What (any?) preprocessor directives does djgpp (gcc, unix, dos, etc)
> set so that the following is possible:
>
> #ifdef _SOME_DJGPP_FLAG_?_
> system("del file.dos");
> #else
> system("rm file.unix");
> #endif
>
> Sorry if the answer is "obvious", but I couldn't find it!
Did you try to look in the FAQ? It's there, in section 8.6.
Note, however, that there's nothing DJGPP-specific in the call to
`system' that you want to issue. The same will work with any other
DOS or Windows compiler. So testing __MSDOS__ and _WIN32 is probably
a better idea than one of the DJGPP-specific symbols listed in the
FAQ.
Also note that if "file.dos" can be an absolute file name, you need to
convert forward slashes to backslashes, or else DEL will choke.
- Raw text -