title: Why do I get a warning saying "assignment makes pointer from integer without a cast"?
body: <p>This is my code for receiving the raw packets from Ethernet in promiscuous mode.  while compiling I get a warning in the line of code </p>
  
  <pre><code>logfile=open("sniff_data.bin",O_CREAT|O_APPEND|O_TRUNC,0777);
  </code></pre>
  
  <p>Warning: assignment makes pointer from integer without a cast [enabled by default]. I checked in google but couldn't find the solution.
  Can anybody tell me the solution and where have I gone wrong?</p>
  
  <pre><code>void ProcessPacket(unsigned char* , int);
  void print_ip_header(unsigned char* , int);
  void print_tcp_packet(unsigned char * , int );
  void print_udp_packet(unsigned char * , int );
  void print_icmp_packet(unsigned char* , int );
  void PrintData (unsigned char* , int);
  
  FILE *logfile;
  struct sockaddr_in source,dest;
  int i,j;
  
  int main()
  {
      int saddr_size,data_size;
      struct sockaddr saddr;
      gopromiscous();
      unsigned char *buffer = (unsigned char *) malloc(1024);  
  
      logfile=open("sniff_data.bin",O_CREAT|O_APPEND|O_TRUNC,0777);  
  
      if(logfile==NULL)
      {
          printf("Unable to create sniff_data file.");
      }
      printf("\n Starting..\n");
  
      int sock_raw = socket( AF_PACKET , SOCK_RAW , htons(ETH_P_ALL)) ;
      setsockopt(sock_raw , SOL_SOCKET , SO_BINDTODEVICE , "eth0" , strlen("eth0")+ 1 );
  
      if(sock_raw &lt; 0)
      {
  
          perror("Socket Error");
          return 1;
      }
      int count=30; 
      while(count&gt;=0)
      { 
          count--;
          saddr_size = sizeof saddr;
          //Receive a packet
          data_size = recvfrom(sock_raw , buffer , 1024, 0 , &amp;saddr , 
            (socklen_t*)&amp;saddr_size);
          if(data_size &lt;0 )
          {
              printf("Recvfrom error , failed to get packets\n");
              return 1;
          }
  
          fwrite(buffer, data_size, 1, logfile);    
  
      }
  
      fclose(logfile);
      close(sock_raw);
      printf("\n");
      printf(" Finished\n\n");
      return 0;
  }
  
  
  int gopromiscous()
    {
  
      int fd;
      struct ifreq eth;
  
      fd = socket(AF_INET, SOCK_PACKET, htons(0x800));
  
      strcpy(eth.ifr_name, "eth0");
  
      ioctl(fd, SIOCGIFFLAGS, &amp;eth);
  
      eth.ifr_flags |= IFF_PROMISC;
  
      ioctl(fd, SIOCSIFFLAGS, &amp;eth);
  
      printf("\n Entered Promiscuous Mode Successfully\n");
  
   }
  </code></pre>