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 <fstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <cstring>
|
#include <system_error>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
string getFileContent(const string& file, const bool& parallel)
|
string getFileContent(const string& file, const bool& parallel)
|
||||||
{
|
{
|
||||||
ifstream fileStream(file, ios::in);
|
ifstream fileStream(file, ios::in);
|
||||||
|
if (not fileStream.fail()) {
|
||||||
string lineinput, fullinput;
|
string lineinput, fullinput;
|
||||||
if (fileStream.is_open()) while (getline(fileStream, lineinput)) {
|
while (getline(fileStream, lineinput)) {
|
||||||
fullinput.append(lineinput += '\n');
|
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();
|
fileStream.close();
|
||||||
return fullinput;
|
return fullinput;
|
||||||
|
} else throw Yerbacon::Exception("Could not open \"" + file + "\" : " + generic_category().message(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
void outputFileContent(const string& file, const string_view content) {
|
void outputFileContent(const string& file, const string_view content) {
|
||||||
|
|
|
@ -18,11 +18,6 @@
|
||||||
#error "A valid std::threads implementation is required"
|
#error "A valid std::threads implementation is required"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
// #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <version>
|
#include <version>
|
||||||
#if not defined(__cpp_lib_concepts) || not defined(__cpp_lib_integer_comparison_functions)
|
#if not defined(__cpp_lib_concepts) || not defined(__cpp_lib_integer_comparison_functions)
|
||||||
#error "The current standard library is incomplete"
|
#error "The current standard library is incomplete"
|
||||||
|
|
Loading…
Reference in New Issue