Hi,
How to create an array of string from an input file? I was using the following cods and got error.
Ex:
Input file: suit.txt has 4 lines
hearts
diamonds
clubs
spades
code:
char *suitArr[4];
...
ifstream infile("suit.txt", ios::in);
...
for (int x=0; x < 4; x++)
{
infile.getline(inlineBuf,20);
char *suiteArr[x] = new char [strlen(inlineBuf) +1);
assert( suiteArr[x] !0 );
strcpy(suitArr[x],inlineBuf);
}