首页 > 其他 > 详细

Boost filesystem Tutorial Digest

时间:2014-04-10 21:33:11      阅读:475      评论:0      收藏:0      [点我收藏+]

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, "\n"));

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:\boost\boost_1_54_0\stage\lib

 

这在[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

Boost filesystem Tutorial Digest,布布扣,bubuko.com

Boost filesystem Tutorial Digest

原文:http://www.cnblogs.com/zhouzhuo/p/3656362.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!