when I use oatpp::String::loadFromFile(),a question comes to my mind: How loadFromFile deal with \0?
I look up the source code and find loadFromFile read file in binary mod, and then cast the file data into char and build a oatpp::String object return.
if there is occasionally 8bit 0 in the file and loadFromFile cast it into char and build oatpp::String from it, the content of file may be cut since it contain a \0 in string body.
auto s = oatpp::String::loadFromFile(FILEPATH)
createResponse(Status::CODE_200, s)
I would like to know if the above scenario will happen, If so, Is there any good way to fill response body with byte stream directly?
oatpp::Stringis NOT a null-terminated string. oatpp will load the full content of the file to string and will return the full content in response.From
loadFromFile()implementation: