基于入门的环境及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

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. 怎样下载JDBC驱动

    MySQL官网: https://www.mysql.com/ 请注意: 需要把mysql-connector-java-5.1.45-bin.jar放到C:\JMeter\apache-jmeter ...

  2. svn清理报错:Cleanup failed to process the following paths

    这里碰到svn更新时,提示清理,清理时报错: 只需进行以下几个步骤即可解决:(原理即是清除掉svn数据库里的lock记录) 1.下载SQLiteManager,svn用的是sqlite数据库,需要一款 ...

  3. Objective-C 点语法 成员变量的作用域 @property和@synthesize关键字 id类型

    点语法 1.利用点语法替换set方法和get方法 方法调用 Student *stu = [Student new]; [stu setAge : 18]; int age = [stu age]; ...

  4. lintcode433 岛屿的个数

    岛屿的个数 给一个01矩阵,求不同的岛屿的个数. 0代表海,1代表岛,如果两个1相邻,那么这两个1属于同一个岛.我们只考虑上下左右为相邻. 您在真实的面试中是否遇到过这个题? Yes 样例 在矩阵: ...

  5. EF中如何为表添加新的字段和映射

    首先先了解一下ef生成的模型edmx的代码,传送门:http://www.cnblogs.com/yushengbo/p/4807715.html 一.添加新的字段 例子就用我现在项目的这个吧,首先在 ...

  6. 20届的阿里 头条 网易 滴滴 百度 小米等Java面经

    转载连接 个人博客:junxuelian.cn 总结:个人感觉回答面试官问题不必太官方和书面化,腾讯sng招实习被发现照着百度百科念.结果可想而知.用自己的话和理解去回答就好.可能应届生会抱怨设计题, ...

  7. 应用Response.Write实现带有进度条的多文件上传

    前几天,写过一篇随笔“使用RESPONSE.WRITE实现在页面的生命周期中前后台的交互”.说是交互,实际上也主要是在ASP.NET的页面周期中 从后台利用RESPONSE.WRITE向前台即时的推送 ...

  8. 5.hadoop常用命令

    1. 单独启动和关闭hadoop服务 启动名称节点 #hadoop-daemon.sh start namenode 启动数据节点 #hadoop-daemons.sh start datanode ...

  9. PHPCMS v9表单向导中怎么加入验证码

    表单想到比较简单,所以没有加入验证码的功能.网上的类似教程又大多数不准确.所以亲自测试了一下,发现下面的方法是可用的.希望对有需求的朋友们有所帮助. 1.首先是调用表单的页面加入验证码.表单js调用模 ...

  10. c#和.net区别

    .net 包含两大部分:.net framework类库和公共语言运行库(CLR) .net framework类库,就是微软工程师写好的各种功能类,例如math类. 公共语言运行库:1.与操作系统进 ...