Poco::File
基于入门的环境及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的更多相关文章
- c++ poco库https调用
#include "Poco\File.h"#include "Poco\FileStream.h"#include "Poco\Process.h& ...
- Poco之ftp获取文件列表以及下载文件
#include <iostream>#include <string>#include <vector>#include <algorithm>#in ...
- POCO文档翻译:POCO C++库入门指南
内容目录 介绍 Foundation库 XML库 Util库 Net库 将这些东西组合到一起 介绍 POCO C++库是一组开源C++类库的集合,它们简化及加速了用C++来开发以网络功能为核心的可移植 ...
- 使用GDB 追踪依赖poco的so程序,core dump文件分析.
前言 在windows 下 系统核心态程序蓝屏,会产生dump文件. 用户级程序在设置后,程序崩溃也会产生dump文件.以方便开发者用windbg进行分析. so,linux 系统也有一套这样的东东- ...
- linux 下cmake 编译 ,调用,调试 poco 1.6.0 小记
上篇文章 小记了: 关于 Poco::TCPServer框架 (windows 下使用的是 select模型) 学习笔记. http://www.cnblogs.com/bleachli/p/4352 ...
- Poco C++库网络模块例子解析2-------HttpServer
//下面程序取自 Poco 库的Net模块例子----HTTPServer 下面开始解析代码 #include "Poco/Net/HTTPServer.h" //继承自TCPSe ...
- Poco之ftp目录切换与创建
TEMPLATE = app QT += qml quick widgets#LIBS += -lPocoFoundation -lPocoXML -lPocoNetSOURCES += main.c ...
- POCO C++ lib开发环境构建
Welcome Thank you for downloading the POCO C++ Libraries and welcome to the growing community of POC ...
- 使用T4模板生成POCO类
为什么叫T4?因为简写为4个T. T4(Text Template Transformation Toolkit)是微软官方在VisualStudio 2008中开始使用的代码生成引擎.在 Visua ...
随机推荐
- Jmeter做压力测试的心得
什么是性能压测? 也是最近刚刚接触到,就是被测试的系统,在一定的访问压力下,看程序运行是否稳定/服务器运行是否稳定,通常情况,是模拟多个请求同时 请求服务器,也就是在某个时间内,比如说1秒内,调用接口 ...
- zookeeper应用:屏障、队列、分布式锁
zookeeper工具类: 获取连接实例:创建节点:获取子节点:设置节点数据:获取节点数据:访问控制等. package org.windwant.zookeeper; import org.apac ...
- TW实习日记:第20-21天
为什么上周五没写呢,因为上周五一直在熟悉业务流程...根本不会写一些复杂的业务代码,因为没有业务流程图!!!在学校的上需求分析和UML建模课的时候,还有软件工程课的时候,想着这都什么鬼啊,听来干嘛,写 ...
- 论文笔记:Deep Attentive Tracking via Reciprocative Learning
Deep Attentive Tracking via Reciprocative Learning NIPS18_tracking Type:Tracking-By-Detection 本篇论文地主 ...
- DataSet转化为DataTable
. DataTable dt = ds.Tables[]; . DataTable dt = dao.FillTables("GetOptions_DKI_City_HCPName" ...
- 十一:Centralized Cache Management in HDFS 集中缓存管理
集中的HDFS缓存管理,该机制可以让用户缓存特定的hdfs路径,这些块缓存在堆外内存中.namenode指导datanode完成这个工作. Centralized cache management i ...
- 三:QJM HDFS高可用
本文介绍的是HDFS的一种HA方案.虽然有checkpoint node \backup node等,但是不能实现自动的failover. http://hadoop.apache.org/docs/ ...
- 福大软工1816:Alpha(9/10)
Alpha 冲刺 (9/10) 队名:第三视角 组长博客链接 本次作业链接 团队部分 团队燃尽图 工作情况汇报 张扬(组长) 过去两天完成了哪些任务: 文字/口头描述: 1.完善通过父子进程调用wxp ...
- lintcode-186-最多有多少个点在一条直线上
186-最多有多少个点在一条直线上 给出二维平面上的n个点,求最多有多少点在同一条直线上. 样例 给出4个点:(1, 2), (3, 6), (0, 0), (1, 3). 一条直线上的点最多有3个. ...
- lintcode-138-子数组之和
138-子数组之和 给定一个整数数组,找到和为零的子数组.你的代码应该返回满足要求的子数组的起始位置和结束位置 注意事项 There is at least one subarray that it' ...