It is necessary to bring the table to the file stream. Integers are formatted with spaces. How to disable it, I have a column delimiter - a space.

#include <fstream> #include <locale> int main() { std::locale::global(std::locale("")); auto file = std::wofstream("table.txt", std::ios::out | std::ios::trunс); for(const auto & line : getLines()) { for(const auto & value : line) { file << L' ' << value; } file << L'\n'; } return 0; } 

An example of a row of 4 columns {integer, row, integer, real}, the first column has the type INT64 ( signed __int64 ):

1 235 346 563 356 523 234 ready 43 0.5903

  • Probably a Russian (or German, for example) locale? - VladD
  • one
    Try this at the beginning of the program: std::locale::global(std::locale("C")); std::cout.imbue(std::locale()); std::locale::global(std::locale("C")); std::cout.imbue(std::locale()); . - VladD
  • However, if you print lines, then the space as a separator is not a good idea: the lines themselves may contain spaces. But this is another problem. You should think about some higher level format, for example, CSV. - VladD
  • @VladD the format does not depend on me, the requirements are - Cerbo
  • Did setting locale help? - VladD

0