title: how to del and add route with c code or object c in macosx
body: <p>In macosx, an important part if my project is to delete the original route entry , and add the necessary new route to the system. when the project exits, I need to restore the original route table as before.</p>
  
  <p>unlike the linux or windows, the command to delete or add the route is so complex with so many arguments to consider. apart from that, when use the </p>
  
  <pre><code>netstat -nr
  </code></pre>
  
  <p>to print the route table, the different presentations of gateway and the flags of each table are troubling me.</p>
  
  <p>so if there are apis to delete and add the route in macosx ,c or object-c ,either appreciated.</p>
  
  <p>All I know that in linux We can use the ioctl plus the SIOCADDRT OR SIOCDELRT to accomplish this ,but mac doesn't support that.</p>