Try this out, then compare the two programs and see what changes I made. And just so that I don't get complaints, void main is not standard and therefore you shouldn't do it. The standard dictates that int main(void) should be used.
p.s. I had to create my own data file to test this, but it works quite well.
using namespace std;
int a = -1;
cout << "Error opening file.\n";
new_name.getline (name, 255, '\n');
namearray[a] = new char;
for (int v=0; v < a; v++)
cout << namearray [v] << " " << endl;