w*s 发帖数: 7227 | 1 【 以下文字转载自 Programming 讨论区 】
发信人: wds (净洗前尘,从头再来), 信区: Programming
标 题: shall i call system("ifconfig eth0 ... up") or write my own code ?
发信站: BBS 未名空间站 (Sun Oct 14 11:20:17 2012, 美东)
for a complicated linux application,
we need to configure ethernet port a lot,
e.g. bring up the port, for 2 ways,
1. system("ifconfig eth0 ... up")
2. write a c function
which way is better ? any concerns for method 1 ? |
a9 发帖数: 21638 | 2 有些发行版已经不带ifconfig了,比如arch
【在 w*s 的大作中提到】 : 【 以下文字转载自 Programming 讨论区 】 : 发信人: wds (净洗前尘,从头再来), 信区: Programming : 标 题: shall i call system("ifconfig eth0 ... up") or write my own code ? : 发信站: BBS 未名空间站 (Sun Oct 14 11:20:17 2012, 美东) : for a complicated linux application, : we need to configure ethernet port a lot, : e.g. bring up the port, for 2 ways, : 1. system("ifconfig eth0 ... up") : 2. write a c function : which way is better ? any concerns for method 1 ?
|
b**r 发帖数: 352 | 3 system() usually is a quick and dirty way of doing stuff.
1. it's much slower than using system calls directly.
2. difficult to know if execution was done just as the way intended. |
w*s 发帖数: 7227 | 4 这些发行版是linux的叛徒 !!!
【在 a9 的大作中提到】 : 有些发行版已经不带ifconfig了,比如arch
|
d********g 发帖数: 10550 | 5 这些万年不更新的package才是叛徒。没有ifconfig还有ip这个命令可用
RHEL/CentOS之流才是Linux界的耻辱
【在 w*s 的大作中提到】 : 这些发行版是linux的叛徒 !!!
|
n******t 发帖数: 4406 | 6 I agree changing default command is totally stupid.
But generally you do not want to invoking shell command in your
c code, unless it is quick and dirty solution.
【在 w*s 的大作中提到】 : 这些发行版是linux的叛徒 !!!
|