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 ...
随机推荐
- PyMySQL连接MySQL数据库
首先, 添加PyMySQL模块: 代码: import pymysql db = pymysql.connect(host="localhost", user="root ...
- STL之--插入迭代器(back_inserter,inserter,front_inserter的区别)
除了普通迭代器,C++标准模板库还定义了几种特殊的迭代器,分别是插入迭代器.流迭代器.反向迭代器和移动迭代器,定义在<iterator>头文件中,下面主要介绍三种插入迭代器(back_in ...
- facebook演讲
任何为了更大愿景工作的人,可能会被称为疯子,即使你最终获得成功. 任何为了复杂问题工作的人,都会因为不能全面了解挑战而被指责,即使你不可能事先了解一切. 任何抓住主动权先行一步的人,都会因为步子太快而 ...
- sql随机数
) as P_jsnews_id ) as P_jsnews_id) * from P_jsnews order by newid()
- RedHat/CentOS利用iso镜像做本地yum源
在这里用iso或者光盘做本地yum源的方法是差不多的,只是用光盘的话Linux系统会自动挂载,用iso镜像的或需要手动挂载,这里就说挂载iso的方法吧. (1) 创建iso存放目录和挂载目录 mkdi ...
- POJ 3714 Raid(计算几何の最近点对)
Description After successive failures in the battles against the Union, the Empire retreated to its ...
- 条款02:尽量以const,enum,inline替换#define
一.概述 尽量少用预处理器——宏替换 二.细节 1. 关于宏替换之常量 旧版本:#define N 10; 新版本:const int n = 10; 比较:#define不被视为语言的一部分,记号名 ...
- 正确使用memset
今天做了一道素数打表的题我在使用一个数组记录是否为素数的时候使用了memset,将数组里面的数都清为1,代表是素数,不是素数,就改成0,我在判断这一个数是否为素数是依据也是是0还是1,结果一直存在问题 ...
- python学习笔记01:安装python
下载python: 从从https://www.python.org/downloads/下载python,根据操作系统的不同,选择不同的版本下载.注意:linux系统大多预装了python,可以直接 ...
- CSS 经典三列布局
一 圣杯布局 1 html结构 <!DOCTYPE html> <html> <head> <title></title> <link ...