interface Flags

I have written the following program to get the inerface flags for the en0
interface.The Program reports “Operation not supported”.
Can anyone please tell is the operation really not supported or Iam making
any mistake.
Later i want to set the flags with the help of ioctl.
Can any one pls tell how it can be done
Thanking for any reply in Advance

#include <stdio.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <string.h>
#include <errno.h>
struct ifreq if_req;
int main()
unsigned int retval,fd;
memset (&if_req, 0, sizeof(if_req));
if_req.ifr_ifru.ifru_flags = 0;
fd = open("/dev/io-net/en0", 0);
retval=ioctl(fd, SIOCGIFFLAGS, (caddr_t)&if_req);
if(retval == -1) {
printf(“First ioctl returned -1 %d”,errno);
printf("\nThat means %s\n",strerror(errno));
exit (0);
printf("\nThe flags are %d",if_req.ifr_ifru.ifru_flags);

He who is seeking knowledge should give up comfort,
He who is seeking comfort should give up learning knowledge,
As the knowledge seeker can not get comfort and
a comfort seeker can not learn knowledge.