#include <iostream>
#include <sstream> // replace this with fstream

int main()
{
	const int MAX_STRINGS = 10;
	const int MAX_STRING_LEN = 20;
	
	char* strings[MAX_STRINGS] = {0};
	
	std::istringstream ss("test1,test2,test3"); // replace this with std::ifstream
	
	char* str;
	int i = 0;
	
	while(ss)
	{
		str = new char[MAX_STRING_LEN];
		ss.getline(str, MAX_STRING_LEN, ',');
		strings[i++] = str;
	}
	
	// print each string then delete it
	for(int i = 0; i < MAX_STRINGS; ++i)
	{
		if(strings[i])
		{
			std::cout << strings[i] << std::endl;
			delete[] strings[i];
		}
	}
	
	return 0;
}