分类:
2012-07-16 10:15:23
gjf05_052012-07-18 23:09:23
二陷阱
fedora 下运行结果是:
[gou@localhost onweb]$ ./share_memory_pitfall
Failed to attach shared memory,times[01],errno:13
Failed to attach shared memory,times[02],errno:13
Failed to attach shared memory,times[03],errno:13
Failed to attach shared memory,times[04],errno:13
Failed to attach shared memory,times[05],errno:13
Failed to attach shared memory,times[06],errno:13
Failed to attach shared memory,times[07],errno:13
Failed to atta
gjf05_052012-07-18 12:56:03
一.应用的示例程序 strncpy(p_setting->agen,"jinyh",10);
中的str ncpy 我第一次把它看成是st m cpy,结果错了。
最后我编译时写成:strcpy(p_setting->agen,"jinyh");成功。
strncpy也能行。
运行结果:[gou@localhost onweb]$ ./share_memory
agen;jinyh
file_no:1
------ Shared Memory Segments --------
key shmid owner perms b