poco之文件系统

这篇博客介绍了Poco库中的文件系统操作类,包括Poco::Path、Poco::File、Poco::TemporaryFile、Poco::DirectoryIterator和Poco::Glob。重点讲解了Poco::Path类的路径处理,如路径简介和类说明。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Poco库中,封装了一些类去完成文件系统的操作,这些类包括:

              1. Poco::Path

              2. Poco::File

              3. Poco::TemporaryFile

              4. Poco::DirectoryIterator

              5. Poco::Glob


1. Poco::Path

1.1 路径:

               1. 在不同操作系统中,指明文件和目录所在位置的标示符是不一样的。
               2. 标示符的不一致,会造成代码在不同平台之间移植的困难。
               3. Poco::Path类抽象了不同标识符之间的区别,使程序员可以把注意力集中在业务的开发上。
               4. Poco::Path类支持Windows、Unix、OpenVMS操作系统。


1.2 Poco路径简介:

                Poco中的路径包括了
               1. 一个可选的节点(node)名:
                              a) 在Windows上,这是计算机在UNC( Universal Naming Convention )路径中的名字
                              b) 在OpenVMS中,这代表一个集群系统中的节点名
                              c) 在Unix中,此名字未被使用。
               2. 一个可选的设备(device)名:
                              a) 在Windows上,这是一个驱动器盘符
                              b) 在OpenVMS上,这是存储盘符的名字
                              c) 在Unix,此名字未被使用。
               3. 一个目录名的列表
               4. 一个文件名(包括扩展名)和版本号(OpenVMS特有)

                Poco支持两种路径 :
               1. 绝对路径
               以根目录为起点的描述资源的目录
               2. 相对目录
               以某一个确定路径为起点的描述资源的目录(通常这是用户的当前目录)

               相对目录可以被转换为绝对目录(反之,并不成立)。
               在Poco中路径的指向可以是一个目录也可以是一个文件。当路径指向目录时,文件名为空。

               下面是Poco中关于路径的一些例子:

Path: C:\Windows\system32\cmd.exe  
    Style: Windows  
    Kind: absolute, to file  
    Node Name: –  
    Device Name: C  
    Directory List: Windows, system32  
    File Name: cmd.exe  
    File Version: –  
  
Path: Poco\Foundation\  
    Style: Windows  
    Kind: relative, to directory  
    Node Name: –  
    Device Name: –  
    Directory List: Poco, Foundation  
    File Name: –  
    File Version: –  
  
Path: \\www\site\index.html  
    Style: Windows  
    Kind: absolute, to file  
    Node Name: www  
    Device Name: –  
    Directory List: site  
    File Name: index.html  
    File Version: –  
  
Path: /usr/local/include/Poco/Foundation.h  
    Style: Unix  
    Kind: absolute, to file  
    Node Name: –  
    Device Name: –  
    Directory List: usr, local, include, Poco  
    File Name: index.html  
    File Version: –  
  
Path: ../bin/  
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值