Hey Guys,
I want to read from a file. And store the string in a string class array. Number of strings in the file is unknown. How could this be done?
int n=0;
while(!inFile2.eof())
{
string tempStr = getWord(inFile2,n);
if(tempStr.length() >=1)
{
wordCount++;
}
}
inFile2.close();
inFile2.open(inFileName2.c_str());
string wordStr[wordCount];
n=0;
while(!inFile2.eof())
{
string tempStr = getWord(inFile,0);
if(tempStr.length() >=1)
{
omitWordStr[n] = tempStr;
}
n++;
}
bbcode
i am getting an error that expected constant expression.
Is there an easier way other than this logic? By doing it this way, I find my self getting string twice.
Thanks,