ftok() ENOENT: A component of path does not exist, or path is an empty string.
来源:互联网 发布:医药软件哪个好 编辑:程序博客网 时间:2024/05/16 05:34
使用环境:Ubuntu 11.11 c++
错误产生:
使用ftok()函数来映射一个键值,函数很简单
#include <sys/types.h>
#include <sys/ipc.h>
key_t ftok(const char *pathname, int proj_id);
即传递一个路径名,一个辅助数值即可唯一定位一个键值
代码如下:
//获取对应的键值 key_t key=ftok(SEM_PATH, 25);
其中,#define SEM_PATH "stuy1001593"
但是在执行的时候出现如下错误提示(需要自己来输出):
ENOENT: A component of path does not exist, or path is an empty string.
查找原因:
参数名是pathname,即一个路径名。以前没用过该函数,也没有查详细的文档,所以就随便写了
原来man ftok里已经说明:
pathname (which must refer to an existing, accessible file)
即,必须指向一个已经存在,并可以访问的文件(文件夹也可以)
问题解决:
重新给SEM_PATH赋值成一个有效的路径,映射成功!
- ftok() ENOENT: A component of path does not exist, or path is an empty string.
- Invalid proguard configuration file path D:\...\proguard.cfg does not exist or is not a regular file
- Invalid proguard configuration file path D:\...\proguard.cfg does not exist or is not a regular file
- Invalid proguard configuration file path D:\...\proguard.cfg does not exist or is not a regular fil
- Invalid proguard configuration file path D:\...\proguard.cfg does not exist or is not a regular file
- UICollectionView recieved layout attributes for a cell with an index path that does not exist 解决办法
- java.lang.UnsatisfiedLinkError,(A file or directory in the path name does not exist.
- A context path must either be an empty string or start with a '/' and do not end with a '/' 问题解决方法
- does not exist or is not a readable directory
- ..\TestApp does not exist or is not a readable directory
- Shortest Path in a weighted Graph where weight of an edge is 1 or 2
- fatal: destination path ‘文件夹名’ git clone already exists and is not an empty directory解决方法
- git fatal: destination path '**' already exists and is not an empty directory.解决
- fatal: destination path '.' already exists and is not an empty directory. 错误及解决办法
- GlusterFS: {path} or a prefix of it is already part
- netbean中does not exist or is not a readable错误的解决
- 关于error C2871: 'std' : does not exist or is not a namespace处理
- netbean中does not exist or is not a readable错误的解决
- LDD3源码分析之slab高速缓存
- 设计模式 (二)工厂方法模式(FactoryMethod)
- iPhone/Mac Objective-C内存管理教程和原理剖析
- extern用法详解(转)
- setsockopt设置socket状态
- ftok() ENOENT: A component of path does not exist, or path is an empty string.
- Android设置全屏
- 十六、设计模式 之 命令模式
- CentOS6.2下源码安装openStack glance
- Android Widget 实例(世界杯倒计时)
- jQuery基础教程之强大的选择器(层次选择器)
- 【编程技巧】do...while(0)的妙用
- PHP trim() 函数
- java继承