This program will read the csv and write all of the content into a txt file. However, when I compiled it and open the txt, the only thing I could see is blank, nothing in the file.
What did I go wrong?
1,18127221,Nguyen Van,Tuan,Male,4/11/2000
As I see, I can't use getline to read the integer.
How to read the numbers while there is a comma behind them?
You can read the numbers as a string up to the comma and store the string value into a dummy string. After that, you can convert the dummy string into an integer using std::stoi (string to int).
1 2 3
std::string dummyString;
getline(in, dummyString, ',');
No = std::stoi(dummyString);