Skip to content

Commit

Permalink
Remove newline in version (#1891)
Browse files Browse the repository at this point in the history
* remove newline in version

* .

* .

Co-authored-by: CaCO3 <[email protected]>
  • Loading branch information
caco3 and CaCO3 committed Jan 21, 2023
1 parent bc614a7 commit 2f56af4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions code/main/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ extern "C"
#include <string.h>
#include "Helper.h"
#include <fstream>
#include <algorithm>


const char* build_time(void)
Expand Down Expand Up @@ -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){
Expand All @@ -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

0 comments on commit 2f56af4

Please sign in to comment.