Re: linux app to windows
- From: Victor Bazarov <v.Abazarov@xxxxxxxxxxxx>
- Date: Wed, 19 Nov 2008 22:25:52 -0500
Kyle wrote:
I have been given the task of trying to migrate a linux app that one of the other admins wrote to windows. The source code is basically straight C with a few small issues, most of which are easily fixed. I have one question: Is there any way to have an if statement like this:
if compiling on linux
define strlwr(...,...)
end if
As you can see linux doesn't have a strlwr function so I need to define it, but windows has one. The goal is to allow the app to compile on both linux and windows so having the if wrapper would greatly help. All the app does is read in a file, flip somethings around, and write out a new file.
I think you're looking for a preprocessor directive for conditional compilation. Something like
#ifndef WIN32
#define strlwr(...,...)
#endif
Yes? No? Did I guess right? See the compiler documentation that would explain what preprocessor macros are pre-defined for you and look for something that would identify the target OS. I don't know what a Linux compiler would have defined if the target OS is Linux. But it would probably have "linux" in the name...
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
- Follow-Ups:
- Re: linux app to windows
- From: Kyle
- Re: linux app to windows
- From: Hendrik Schober
- Re: linux app to windows
- References:
- linux app to windows
- From: Kyle
- linux app to windows
- Prev by Date: Re: control loop help
- Next by Date: saving Base64 encoded string to a file
- Previous by thread: linux app to windows
- Next by thread: Re: linux app to windows
- Index(es):
Relevant Pages
|