zoukankan      html  css  js  c++  java
  • Boost filesystem Tutorial Digest

    1. Boost.Filesystem file_size function returns a uintmax_t containing the size of the file named by the argument. The declaration looks like this:

    uintmax_t file_size(const path& p);

    2. For now, all you have to know is that class path has constructors that take const char* and many other useful types.

    3. Using status queries to determine file existence and type, such as exists, is_directory and is_regular_file. And a file's status can be regular file, directory file and other type.

    4. Directory_entry. A directory_entry object stores a path object, a file_status object for non-symbolic link status, and a file_status object for symbolic link status.

    5. directory_entry. After a directory_iterator is constructed, and every time operator ++ is called, it reads a directory element and stores information about it in a object of type directory_entry.

    Two end iterators are always equal.

    Directory iteration shall not yield directory entries for the current (dot) and parent (dot dot) directories.

    6. recursive_directory_iterator. Objects of type recursive_directory_iterator provide standard library compliant iteration over the content of a directory, including recursion into its sub-directories.

    The behavior of a recursive_directory_iterator is the same as a directory_iterator unless otherwise specified.

    Incrementing a recursive_director_iterator pointing to a directory causes that directory itself to be iterated ovee, as specified by the operator++ and increment functions.

    When a recursive_directory_iterator reaches the end of the directory currently being iterated over, or when pop() is called, m_level is decremented, and iteration of the parent directory continues.

    7. copy(directory_iterator(p), directory_iterator(), ostream_iterator<directory_entry>(cout, " "));

    copy(InputIterator first, InputIterator last, OutputIterator result)

    directory_itertor() return last.

    vector<int> vec_it1, vec_it2;

    copy(vec_it1.begin(), vec_it1.end(), vec_it2.begin());

    copy(vec_it1.begin(), vec_it1.end(), back_inserter(vec_it2));

    8. Building boost from visual studio 2012

    Properties > Linker > General > Additional Library Directories添加包含的库目录

    例如:D:oostoost_1_54_0stagelib

    这在[2] 没有提到, 但缺少这个步骤的话会报错

    Reference

    [1] http://www.boost.org/doc/libs/1_55_0/libs/filesystem/doc/tutorial.html

    [2] http://www.boost.org/doc/libs/1_55_0/more/getting_started/windows.html#build-from-the-visual-studio-ide

    [3] http://blog.csdn.net/xzz_hust/article/details/9365511

  • 相关阅读:
    求正方形的面积和周长
    面向对象练习——校园管理系统
    python--面向对象(最全讲解)
    git删除远程仓库的文件或目录
    git设置忽略文件和目录
    计算器
    织梦标签整理
    比较恶心的360老年版浏览器 文件导出下载
    织梦文章列表样式多元化实现
    php函数整理
  • 原文地址:https://www.cnblogs.com/zhouzhuo/p/3656362.html
Copyright © 2011-2022 走看看