#include<iostream>
#include<typeinfo>
#include<Poco/Path.h>
using namespace std;
using namespace Poco;
int main(){
    Path my_path ("/media/ygy/KINGSTON");
    Path path1 = my_path.absolute();
    cout<< Path::current()<<endl;
    cout <<my_path.depth()<<endl;     for(int i=0;i<=path1.depth();i++){
        cout<<my_path.directory(i)<<endl;
        cout<<my_path[i]<<endl;
    }
} root@goodjob:~/work/poco/path# ./test
root@goodjob:~/work/poco/path# ./test
/home/ygy/work/poco/path/
2
media
media
ygy
ygy
KINGSTON
KINGSTON

static std::string current();   Returns the current working directory.

int depth() const;       Returns the number of directories in the directory list.

const std::string & directory(int n) const; Returns the n'th directory in the directory list. If n == depth(), returns the filename.

bool isDirectory() const;Returns true if and only if the path references a directory (the filename part is empty).

      只有路径字符串末尾是/的时候,判断为真,其余都是假。

bool isFile() const; Returns true if and only if the path references a file (the filename part is not empty).

      路径字符串末尾不是/的时候,为真。

Path & makeDirectory();

    If the path contains a filename, the filename is appended to the directory list and cleared. Thus the resulting path       always refers to a directory.

Path & makeFile();

  If the path contains no filename, the last directory becomes the filename.

Path & makeParent();

  Makes the path refer to its parent.

Path parent() const;

Returns a path referring to the path's directory.

std::string toString() const;

  Returns a string containing the path in native format.

#include<iostream>
#include<typeinfo>
#include<Poco/Path.h>
#include <Poco/DirectoryIterator.h>
using namespace std;
using namespace Poco; int main(){
Path my_path ("/media/ygy/YGY");
cout<< Path::current()<<endl;
DirectoryIterator end;
DirectoryIterator it(my_path);
cout<<"-------"<<endl;
Path path2;
for(;it!=end;++it){
cout<<it.name()<<endl;
// path2 = it.path();
// cout<<path2.getFileName()<<endl;
}
} root@goodjob:~/work/poco/path# ./test
/home/ygy/work/poco/path/
-------
desaydata
$TXRAJNL.DAT
text
libTextData.so
update.zip
update.zip.md5
music
DS03H_Common.kzb
bin
lib
radio
libsvp_appfw.so
lns-pic
global-menu
picture
1
System Volume Information
svp.test.mediafw.plugin.native
动态规划
2叉树
排序
libControls.so
3.1.3
3.1.10.2
libPictureData.so
svp.svc.appmgr
svp.svc.media.indexing
new folder
libsvp_mediafw-plugin-native-db.so
lns-pic-0
lns-pic-1
lns-pic-2
genivi

DirectoryIterator();

  Creates the end iterator.

DirectoryIterator( const std::string & path);

  Creates a directory iterator for the given path.

const Path & path() const;

  Returns the current path.

const std::string & name() const;

  Returns the current filename.

const File & operator * () const;

const File * operator-> () const;

    cout<<(*it).canRead()<<endl;
cout<< it->canRead()<<endl;

最新文章

  1. MI卡UID
  2. 如何用Eclipse进行单元测试
  3. YII 的基本CURL操作
  4. Eclipse 导入 Hadoop 源码
  5. Nexus Root Toolkit教程—— 解锁与Root
  6. javascript中对象的不同创建方法
  7. [转]How to create an anonymous IDA PRO database (.IDB)
  8. 在cmd模式下对mysql的操作语句
  9. 微信授权登录mock(在没有真实微信账号的情况下测试大量微信账户授权登录的情况)
  10. [模板]Min_25筛
  11. 打包maven后出现jar包丢失
  12. Java知多少(30)多态和动态绑定
  13. Android Studio 修改Logcat的颜色
  14. 团队作业Beta冲刺-第三天
  15. virtIO之VHOST工作原理简析
  16. 流媒体协议之JRTPLIB的使用20170919
  17. Java使用 VelocityEngine模板引擎快速生成HTML等各种代码
  18. vue-cli使用swiper4在ie以及safari报错
  19. ZOJ1937:Addition Chains——题解
  20. CodeFores 665D Simple Subset(贪心)

热门文章

  1. 使用Iview Menu 导航菜单(非 template/render 模式)
  2. 初学Direct X(9) ——文字的显示
  3. 【input】输入框组件说明
  4. vector的基础使用
  5. 孤荷凌寒自学python第八十二天学习爬取图片2
  6. nordic mesh中的消息缓存实现
  7. mouseover 和 mouseout 事件是可以冒泡的 取消
  8. 四:HDFS Snapshots
  9. Python中的名字隐藏
  10. 如何遍历一个文件夹(C语言实现)