Remove newline in version (#1891)

* remove newline in version

* .

* .

Co-authored-by: CaCO3 <caco@ruinelli.ch>
This commit is contained in:
CaCO3
2023-01-21 21:54:31 +01:00
committed by GitHub
parent eddf59cdb3
commit 457a526792

View File

@@ -15,6 +15,7 @@ extern "C"
#include <string.h>
#include "Helper.h"
#include <fstream>
#include <algorithm>
const char* build_time(void)
@@ -63,7 +64,10 @@ std::string getHTMLversion(void){
fgets(buf, sizeof(buf), pFile); // Line 1: Version
fclose(pFile);
return std::string(buf);
string value = string(buf);
value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); // Remove any newlines
return value;
}
std::string getHTMLcommit(void){
@@ -79,7 +83,10 @@ std::string getHTMLcommit(void){
fgets(buf, sizeof(buf), pFile); // Line 2: Commit
fclose(pFile);
return std::string(buf);
string value = string(buf);
value.erase(std::remove(value.begin(), value.end(), '\n'), value.end()); // Remove any newlines
return value;
}
#endif // _VERSION_H