chinaunix网友2010-10-11 10:23:06
#include
#include
#include
#include
#include
#define err(msg) perror(msg)
struct temp
{
int command;
char str[10];
int append;
};
int main(void)
{
struct temp t;
int fd;
if ((fd = open("/proc/net/atest", O_WRONLY)) == -1)
{
err("open");
goto out;
}
memset(&t, '\0', sizeof(struct temp));
t.command = 1237;
strncpy(t.str, "abcdefg", sizeof(t.str) - 1);
t.append = 7879;
if (write(fd, &t, sizeof