基于入门的环境及makefile。

  1. #include<iostream>
  2. #include<Poco/File.h>
  3.  
  4. using namespace std;
  5. using namespace Poco;
  6. int main(){
  7. File *myfile = new File("/home/ygy/work/poco/file/b.txt");
  8.  
  9. myfile->createFile();
  10.  
  11. cout<<"canRead():"<<myfile->canRead()<<endl;
  12. cout<<"canWrite():"<<myfile->canWrite()<<endl;
  13. myfile->copyTo("/home/ygy/work/poco/file/bin");
  14.  
  15. cout<<"end"<<endl;
  16. }

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

  1. #include<iostream>
  2. #include<Poco/File.h>
  3.  
  4. using namespace std;
  5. using namespace Poco;
  6. int main(){
  7. File *myfile1 = new File("/home/ygy/work/poco/file");
  8. vector<string>files;
  9. vector<File>Files;
  10. myfile1->list(files);
  11. myfile1->list(Files);
  12. cout<<Files.size()<<endl;
  13. for(auto file:files ){
  14. cout<<file<<endl;
  15. }
  16. }

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

Poco::File的更多相关文章

  1. c++ poco库https调用

    #include "Poco\File.h"#include "Poco\FileStream.h"#include "Poco\Process.h& ...

  2. Poco之ftp获取文件列表以及下载文件

    #include <iostream>#include <string>#include <vector>#include <algorithm>#in ...

  3. POCO文档翻译:POCO C++库入门指南

    内容目录 介绍 Foundation库 XML库 Util库 Net库 将这些东西组合到一起 介绍 POCO C++库是一组开源C++类库的集合,它们简化及加速了用C++来开发以网络功能为核心的可移植 ...

  4. 使用GDB 追踪依赖poco的so程序,core dump文件分析.

    前言 在windows 下 系统核心态程序蓝屏,会产生dump文件. 用户级程序在设置后,程序崩溃也会产生dump文件.以方便开发者用windbg进行分析. so,linux 系统也有一套这样的东东- ...

  5. linux 下cmake 编译 ,调用,调试 poco 1.6.0 小记

    上篇文章 小记了: 关于 Poco::TCPServer框架 (windows 下使用的是 select模型) 学习笔记. http://www.cnblogs.com/bleachli/p/4352 ...

  6. Poco C++库网络模块例子解析2-------HttpServer

    //下面程序取自 Poco 库的Net模块例子----HTTPServer 下面开始解析代码 #include "Poco/Net/HTTPServer.h" //继承自TCPSe ...

  7. Poco之ftp目录切换与创建

    TEMPLATE = app QT += qml quick widgets#LIBS += -lPocoFoundation -lPocoXML -lPocoNetSOURCES += main.c ...

  8. POCO C++ lib开发环境构建

    Welcome Thank you for downloading the POCO C++ Libraries and welcome to the growing community of POC ...

  9. 使用T4模板生成POCO类

    为什么叫T4?因为简写为4个T. T4(Text Template Transformation Toolkit)是微软官方在VisualStudio 2008中开始使用的代码生成引擎.在 Visua ...

随机推荐

  1. Python :编写条件分支代码的技巧

    『Python 工匠』是什么? 我一直觉得编程某种意义是一门『手艺』,因为优雅而高效的代码,就如同完美的手工艺品一样让人赏心悦目. 在雕琢代码的过程中,有大工程:比如应该用什么架构.哪种设计模式.也有 ...

  2. 【forEach控制器】-(针对,在不知道取到得参数有多少?但是要全部执行每一条的情况)

    1.使用json提取器,提取全部参数 2.设置forEach控制器,他会自己把json提起器,取到得所有值,全部使用一次再停止. z

  3. python基本数据类型——集合

    集合 无序可变序列,集合中元素不允许重复,即每个元素都是唯一的 集合中的元素按照升序排列 # 创建集合 >>aset = set([0,2,4,5,7,2,3,5,9,0]) >&g ...

  4. Idea Live Templates

    常用live templates 模板 注释 : * * @param $params$ * @return $return$ * $date$ $time$ chiyuanzhen743 */ lo ...

  5. 聊一聊 Flex 中的 flex-grow、flex-shrink、flex-basis

    在使用 flex 布局的时候难以理解的是 flex-grow.flex-shrink.flex-basis 几个属性的用法,下面通过几个例子来演示. flex-basis flex-basis 用于设 ...

  6. java length属性、length()、size()

    length属性 length是属性,用于说明数组的长度. String []list={"wo","shi","shuaibi"}; Sy ...

  7. phantomjs抛出IOException

    使用phantomjs对网页进行截图遇到的问题 问题描述: 使用的phantomjs版本:phantomjs-2.1.1-windows 使用的截图js文件,\phantomjs-2.1.1-wind ...

  8. NTP错误总结

    Ntp错误总结 解决ntp的错误 no server suitable for synchronization found 当用ntpdate -d 来查询时会发现导致 no server suita ...

  9. Jamie and Alarm Snooze

    Description Jamie loves sleeping. One day, he decides that he needs to wake up at exactly hh: mm. Ho ...

  10. ServletContext域对象

    场景:假设某个web服务,有两个servlet分别是servlet1和servlet2,servlet1要传参数name=zhangsan传送给servlet2,传统方法如下: servlet1端:用 ...