Как прочитать текстовый файл в массив строк и преобразовать его из текстового файла с разделителями каналов в csv-файл с разделителями-запятыми?
need help trying to figure out how to use the conversionFile command in c++ program to read an input text file ("test.txt") line by line into an array of strings and then convert it from pipe delimited to comma delimited by writing the changed text into an output csv file. Also need to add additional quotes where they were given. I am stuck on where to start. I know how to do the reading into the array but the actual conversion of pipe to comma delimited, I am stuck on.
What I have tried:
The given "test.txt" is:
Miles per hour|6,445|being the "second" team |5.54|9.98|6,555.00
"Ending" game| left at "beginning"|Elizabeth, New Jersey|25.25|6.78|987.01
|End at night, or during the day|"Let's go"|65,978.21|0.00|123.45
Left-base night|10/07/1900|||4.07|777.23
"Let's start it"|Start Baseball Game|Starting the new game to win
The output csv file is expected to look like this when the pipe delimited is turned to commas and additional quotes are added:
Miles per hour,"6,445","being the ""second"" team member",5.54,9.98,"6,555.00", """Ending"" game","left at ""beginning""","Denver, Colorado",25.25,6.78,987.01, ,"End at night, during the day","""Let's go""","65,978.21",0.00,123.45,
Left-base night, 10/07/1900,,,4.07,777.23,
"""Let's start it""", Start Baseball Game, Starting the new game to win,