基于入门的环境及makefile。

#include<iostream>
#include<Poco/File.h> using namespace std;
using namespace Poco;
int main(){
File *myfile = new File("/home/ygy/work/poco/file/b.txt"); myfile->createFile(); cout<<"canRead():"<<myfile->canRead()<<endl;
cout<<"canWrite():"<<myfile->canWrite()<<endl;
myfile->copyTo("/home/ygy/work/poco/file/bin"); cout<<"end"<<endl;
}

void copyTo(const std::string & path)const; 将该文件复制到某个目录,将文件内容复制到指定文件。

void createDirectories();   创建所有的目录,即使目录的父目录不存在

bool createDirectory();   在已存在的目录下创建目录。

  Returns true if the directory has been created and false if it already exists

bool createFile(); 创建空文件

  Returns true if the file has been created and false if the file already exists

Timestamp created() const;  这个返回类型还不知道怎么显示时间。

  Returns the creation date of the file.

bool exists() const;

Timestamp getLastModified() const;  上次修改时间

FileSize getSize() const;  返回文件字节数,目录是4096

bool isDevice() const;

  Returns true if and only if the file is a device.

bool isDirectory() const;

  Returns true if and only if the file is a directory.

bool isFile() const;

  Returns true if and only if the file is a regular file.

bool isHidden() const;

bool isLink() const;

  Returns true if and only if the file is a symbolic link

void moveTo( const std::string & path);

void list( std::vector < File > & files) const;    获得所有的File对象

void list( std::vector < std::string > & files) const;  获得所有的name

#include<iostream>
#include<Poco/File.h> using namespace std;
using namespace Poco;
int main(){
File *myfile1 = new File("/home/ygy/work/poco/file");
vector<string>files;
vector<File>Files;
myfile1->list(files);
myfile1->list(Files);
cout<<Files.size()<<endl;
for(auto file:files ){
cout<<file<<endl;
}
}

6
main.cpp
bin
a.txt
main.o
Makefile
ddddd

最新文章

  1. iOS学习笔记——使用ChildViewController
  2. sql语句常用说明与解析
  3. 黑马程序员——【Java高新技术】——JDK1.5新特性:静态导入、可变参数、增强型for循环、自动装箱拆箱、枚举
  4. 【UESTC 482】Charitable Exchange(优先队列+bfs)
  5. jQuery判断某个元素是否存在某个样式
  6. Objective-C语言控制语句
  7. TCSRM 591 div2(1000)(dp)
  8. 详细解析: VictorOps 是如何利用和完善 ChatOps?
  9. Student&#39;s Morning
  10. perl 安装AnyEvent::HTTP
  11. {A} + {B}(unique水)
  12. [LeetCode] Is Subsequence 题解
  13. JS数组根据属性来实现排序
  14. nhibernate教程(4)--条件查询(Criteria Query)
  15. Linux上的文件搜索
  16. AsyncTask学习
  17. windows7 java环境配置
  18. 浏览器对象模型BOM总结
  19. appbar导航
  20. 【转】微信小程序实现自动化测试

热门文章

  1. Unity编辑器 - 资源批处理工具基类
  2. ajax的$.get()方法和tomcat服务器的交互
  3. java poi技术读取到数据库
  4. Python3 小工具-TCP发现
  5. SpringCloud IDEA 教学 (二) Eureka Service
  6. Nodejs第一天-{Nodejs基础 深刻理解浏览器 环境变量 基础语法}
  7. Thunder团队——事后诸葛亮会议
  8. 11.24Daily Scrum(3)
  9. Ubuntu使用时遇到的问题
  10. lintcode-14-二分查找