B
Bill Cunningham
Perhaps so but the code above didn't work. This code I wrote did. TheKeith Thompson said:One more thing that you didn't ask about (but probably should have):
How do you expect the symbol LINUX to be defined? Since that
identifier must be available for use in programs, an implementation is
not allowed to pre-define it. There may be other symbols that are
predefined (if you're trying to determine whether you're on a Linux
system); which symbols those might be is a question for another forum.
If you're defining it yourself, that's fine, but you didn't show that.
Also, you appear to be trying to write code that will use things
declared in those implementation-defined headers if you're on a Linux
system, but will still compile and work properly otherwise. Such
things are doable, but the nature of the questions you've been asking
here suggest to me that this is a more advanced topic than you're
ready for.
question is did I do it correctly.
#include <stdio.h>
#include <stdlib.h>
#ifdef linux
#ifndef linux
#undef linux
#include <unistd.h>
#include <sys/types.h>
#include <sys/stats.h>
#include <fctnl.h>
#endif
#endif
I compiled a simple program asking sizeof to show through printf the
size of a long double. I haven't defined linux to use those sys call headers
yet though so that part of the header is untested. But the directives
blocked out the mentioned OT headers to compile a simple C program. I
must've did something right.
Bill