57 template<
typename dtype>
70 std::ifstream file(inFilename.c_str(), std::ios::in | std::ios::binary);
76 file.seekg(0, std::ifstream::end);
77 const uint32 fileSize =
static_cast<uint32>(file.tellg());
78 file.seekg(0, std::ifstream::beg);
80 std::vector<char> fileBuffer;
81 fileBuffer.reserve(fileSize);
82 file.read(fileBuffer.data(), fileSize);
84 if (file.bad() || file.fail())
91 NdArray<dtype> returnArray(
reinterpret_cast<dtype*
>(fileBuffer.data()), fileSize /
sizeof(dtype));
97 if (!(inSep ==
" " || inSep ==
"\t" || inSep ==
"\n"))
102 std::vector<dtype> values;
104 std::ifstream file(inFilename.c_str());
111 std::getline(file, line);
113 std::istringstream iss(line);
119 values.push_back(value);
122 catch (
const std::invalid_argument& ia)
124 std::cout <<
"Warning: fromfile: line " << lineNumber <<
"\n" << ia.what() << std::endl;
128 std::cout <<
"Warning: fromfile: line " << lineNumber << std::endl;