Simplified char buffer construction
This commit is contained in:
parent
cdd1fed777
commit
2121c50735
@ -82,8 +82,7 @@ string sc::file_get_contents(const string& path)
|
|||||||
file.seekg(0, ios::end);
|
file.seekg(0, ios::end);
|
||||||
ios::pos_type file_len {file.tellg()};
|
ios::pos_type file_len {file.tellg()};
|
||||||
file.seekg(0);
|
file.seekg(0);
|
||||||
vector<char> buf;
|
vector<char> buf(file_len);
|
||||||
buf.resize(file_len);
|
|
||||||
file.read(buf.data(), file_len);
|
file.read(buf.data(), file_len);
|
||||||
return {buf.data(), static_cast<string::size_type>(file_len)};
|
return {buf.data(), static_cast<string::size_type>(file_len)};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user