下截boost库,解压,不需要编译,

配置属性》C/C++》常规》附加包含目录,添加boost解压后的目录地址,如下图, 

打开vs2012,新建一个控制台应用程序, 

源代码如下: 

#include <ostream>

#include <boost/iostreams/device/file.hpp>
#include <boost/iostreams/stream.hpp>
namespace io = boost::iostreams;
int main()
{
    io::stream_buffer<io::file_sink> buf("log.txt");
    std::ostream                     out(&buf);

    out << "xxxxxx" ; 

    // out writes to log.txt
}

 

编译成功并执行后,打开log.txt,发现文件里会包含输出的内容 

posted on 2012-10-20 21:08  袁晓平  阅读(1564)  评论(0编辑  收藏  举报