首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

在线linux的readlink函数的使用方法

2012-04-08 
在线求助linux的readlink函数的使用方法各位大虾,求助readlink的使用方法,我使用readlink,每次都返回来一

在线求助linux的readlink函数的使用方法
各位大虾,求助readlink的使用方法,我使用readlink,   每次都返回来一个-1,不知道是哪里出错了,
我的代码是
#include <iostream>
include   <unistd.h>
include   <dirent.h>

int   main()
{
  char   *path   =   new   char[255];

int   count   =   readlink(   "/proc/self/exe ",   path   ,   1023   );
if(count   <   0   ||   count   >   1023)
{
      cout   < <   "find   root   directory   failed     count   =   "   < <   count   < <   endl;
      return   00;
}
path[count]   =   '\0 ';  

cout   < <   "Path   is   "   < <   path   < <   endl;

return   0;
}



[解决办法]
没环境帮你测试:
1。函数使用对码?
2。有权限访问你设置的路径吗?
3。/ 写的对吗 // \\ \ 哪种我就没法试了

热点排行