M**********n 发帖数: 432 | 1 #include
#include
#include
#include
#include
#include
#include
#include
int main()
{
int fd;
if((fd = shm_open("/dev/shm/ttt", (O_RDWR|O_CREAT), (S_IRUSR | S_IWUSR
| S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH ))) <
0)
{
fprintf(stderr, "failed to open file %sn", strerror(errno));
exit(1);
}
return 0;
}
After compiling this simple program, I always got "failed to open file No
such
file or directory" if I run it. But if I changed shm_open to open, it worked
fine.
Does anyone know what is the problem here? | M**********n 发帖数: 432 | 2 Seems like I only need to specify the file name with path in the case of shm
_open.
【在 M**********n 的大作中提到】 : #include : #include : #include : #include : #include : #include : #include : #include : int main() : {
| s*******8 发帖数: 12734 | 3 shm_open("/yourusernmae");
shm
【在 M**********n 的大作中提到】 : Seems like I only need to specify the file name with path in the case of shm : _open.
|
|