added explicit flags ios::in|ios::binary for win32 compat
This commit is contained in:
parent
6914187e0b
commit
fbbf75f032
1 changed files with 35 additions and 34 deletions
|
@ -18,7 +18,7 @@
|
|||
|
||||
#include "dbffile.hpp"
|
||||
#include "utils.hpp"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <string>
|
||||
|
||||
dbf_file::dbf_file()
|
||||
|
@ -50,7 +50,7 @@ dbf_file::~dbf_file()
|
|||
|
||||
bool dbf_file::open(const std::string& file_name)
|
||||
{
|
||||
file_.open(file_name.c_str());
|
||||
file_.open(file_name.c_str(),std::ios::in|std::ios::binary);
|
||||
if (file_.is_open())
|
||||
read_header();
|
||||
return file_?true:false;
|
||||
|
@ -115,7 +115,7 @@ void dbf_file::add_attribute(int col,Feature const& f) const throw()
|
|||
if (col>=0 && col<num_fields_)
|
||||
{
|
||||
std::string name=fields_[col].name_;
|
||||
std::string str=trim(std::string(record_+fields_[col].offset_,fields_[col].length_));
|
||||
std::string str=boost::trim_copy(std::string(record_+fields_[col].offset_,fields_[col].length_));
|
||||
|
||||
switch (fields_[col].type_)
|
||||
{
|
||||
|
@ -172,7 +172,8 @@ void dbf_file::read_header()
|
|||
field_descriptor desc;
|
||||
desc.index_=i;
|
||||
file_.read(name,10);
|
||||
desc.name_=trim_left(name);
|
||||
desc.name_=boost::trim_left_copy(std::string(name));
|
||||
std::clog << "name=" << name << std::endl;
|
||||
skip(1);
|
||||
desc.type_=file_.get();
|
||||
skip(4);
|
||||
|
|
Loading…
Add table
Reference in a new issue