Use generic_category::message() instead of strerror() in filefuncs.cpp
This commit is contained in:
parent
b8223e14f0
commit
3d56bcb10f
|
@ -1,17 +1,19 @@
|
|||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <system_error>
|
||||
using namespace std;
|
||||
|
||||
string getFileContent(const string& file, const bool& parallel)
|
||||
{
|
||||
ifstream fileStream(file, ios::in);
|
||||
string lineinput, fullinput;
|
||||
if (fileStream.is_open()) while (getline(fileStream, lineinput)) {
|
||||
fullinput.append(lineinput += '\n');
|
||||
} else throw Yerbacon::Exception("Could not open \"" + file + "\"" + ((not parallel) ? string(" : ").append(strerror(errno)) : ".")); // TODO: Use a thread-safe function when the parallel mode is in use
|
||||
fileStream.close();
|
||||
return fullinput;
|
||||
if (not fileStream.fail()) {
|
||||
string lineinput, fullinput;
|
||||
while (getline(fileStream, lineinput)) {
|
||||
fullinput.append(lineinput += '\n');
|
||||
}
|
||||
fileStream.close();
|
||||
return fullinput;
|
||||
} else throw Yerbacon::Exception("Could not open \"" + file + "\" : " + generic_category().message(errno));
|
||||
}
|
||||
|
||||
void outputFileContent(const string& file, const string_view content) {
|
||||
|
|
|
@ -18,11 +18,6 @@
|
|||
#error "A valid std::threads implementation is required"
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
|
||||
#define _CRT_SECURE_NO_WARNINGS 1
|
||||
#endif
|
||||
|
||||
#include <version>
|
||||
#if not defined(__cpp_lib_concepts) || not defined(__cpp_lib_integer_comparison_functions)
|
||||
#error "The current standard library is incomplete"
|
||||
|
|
Loading…
Reference in New Issue