#include <iostream> #include <fstream> #include <string> ifstream file("filename.txt"); string data = ""; while(getline(file, data,',')) { cout << data << endl; } file.close();