save csv with correct umlauts even on windows

This commit is contained in:
Martin Brodbeck 2018-08-16 12:40:19 +02:00
parent cfa59a38ac
commit 00f870b0c3
4 changed files with 23 additions and 14 deletions

View file

@ -8,6 +8,8 @@
#include <numeric>
#include <sstream>
namespace fs = std::filesystem;
Marketplace::Marketplace()
{
auto seller = std::make_unique<Seller>("Max", "Mustermann");
@ -168,10 +170,10 @@ void Marketplace::setSalesToDelete(int cashPointNo)
});
}
void Marketplace::exportReportToCSV(const std::string& filename, int feeInPercent, int maxFeeInEuro)
void Marketplace::exportReportToCSV(const fs::path& filePath, int feeInPercent, int maxFeeInEuro)
{
const char delimiter = ',';
std::ofstream file(filename);
std::ofstream file(filePath);
file << "Verk.Nr." << delimiter << "Nachname" << delimiter << "Vorname" << delimiter
<< "Anz. gemeldet" << delimiter << "Anz. verkauft" << delimiter << "Umsatz" << delimiter

View file

@ -5,6 +5,7 @@
#include "sale.h"
#include "seller.h"
#include <filesystem>
#include <vector>
class ExcelReader;
@ -52,7 +53,8 @@ class Marketplace
void clear();
void exportReportToCSV(const std::string& filename, int feeInPercent, int maxFeeInEuro);
void exportReportToCSV(const std::filesystem::path& filePath, int feeInPercent,
int maxFeeInEuro);
friend class ExcelReader;