Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6003639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:08:59+00:00 2026-05-23T01:08:59+00:00

Im trying to add some bindings to ARP table in Linux, in C. Im

  • 0

Im trying to add some bindings to ARP table in Linux, in C. Im opening a file with “a” (append, right?) and then trying to write some addresses, but I always get segmentation fault. I believe there is something wrong with ARP_table[i].IPaddr, ARP_table[i].MACaddr, ARP_table[i].ARPstatus

struct ARP_entry 
{
  char IPaddr[16];
  char MACaddr[18];
  char ARPstatus;
  int timec;
};

static struct ARP_entry ARP_table[ARP_table_vel];

void copyZIS()
{
  int i=0;
  const char filename[] = "/proc/net/arp";
  FILE *file = fopen(filename, "a");


  for (i; i< i+j; i++)
  {
     fprintf(file, "%c %c %c", ARP_table[i].IPaddr, ARP_table[i].MACaddr, ARP_table[i].ARPstatus);
  }

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T01:09:00+00:00Added an answer on May 23, 2026 at 1:09 am

    You are not checking the return value of fopen. I am pretty sure you are not allowed to write to that file.

    FILE *file = fopen(filename, "a");
    if (NULL == file) {
        perror("fopen");
        /* return / exit */
    }
    

    Here is /proc/net/arp on my system

    [cnicutar@aiur ~]$ ls -l /proc/net/arp
    -r--r--r-- 1 root root 0 Jun  8 16:29 /proc/net/arp
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying add vertical lines to my grid. I have found some examples but
I am trying to add some functionality to a page I have inherited, but
I am trying to add some custom build steps to my headless build process
I'm trying to find a way to automate some exception logging code to add
I'm trying to add support for stackoverflow feeds in my rss reader but SelectNodes
I'm currently struggling with one of the bindings I'm trying to add to my
I'm trying to create a mail item and add some attachments to it using
I'm trying to add some gui elements (dialog boxes with buttons) to a game
I'm trying to add some UnitTests to a bunch of Cocoa Legacy code. I
I'm trying to add some style to my app and it's driving me crazy.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.