I am having the following code in C++
char *Names[];
int counter=0;
int _tmain(int argc, _TCHAR* argv[])
{
int data;
ifstream fileX;
fileX.open("myfile",ios::in);
assert (!fileX.fail( ));
fileX >> data;
while(fileX!=eof())
{
createNamesList(data);
fileX >> data;
}
return 0;
}
void createNamesList(char *tmp)
{
Names[counter] = tmp;
counter++;
}
What I want to read the data from file line by line and store each line in a two dimension array char* Names[], so that a whole list is saved with me. the size of data in each line is variable length as well as number of lines are;
like
Name[0] ="Data from Line 1"
Name[1] ="Data from Line 2"
Name[2] ="Data from Line 3"
Name[3] ="Data from Line 4"
.
.
.
The above code give me the following error
error LNK2001: unresolved external symbol "char **Names" (?Names@@3PAPADA)
Your help will be appreciated.
char *Names[];to do?