diff --git a/src/io/file_io.h b/src/io/file_io.h index a88b2f958..6e27e716e 100644 --- a/src/io/file_io.h +++ b/src/io/file_io.h @@ -14,11 +14,12 @@ #include #include +#include namespace knowhere { struct FileReader { FileReader(const std::string& filename, bool auto_remove = false) { - fd_ = open(filename.data(), O_RDONLY); + fd_ = open(filename.c_str(), O_RDONLY); if (fd_ < 0) { throw std::runtime_error("Cannot open file"); } @@ -27,7 +28,7 @@ struct FileReader { lseek(fd_, 0, SEEK_SET); if (auto_remove) { - unlink(filename.data()); + unlink(filename.c_str()); } }