Hello, I'm writing an address book that lets you view a 'bio file' with more info on the person. Here's the code giving me problems:
struct person{char filename[20];};// struct that holds the filename
person *array = new person[NumberOfPeople()];
people.getline(array[i].filename ,20,'\n'); //Get the filecode
i++; //increase the number.
/*This is souposed copy the FileName in the filename array inside the struct for that person*/
void viewbio(const int number)
  char *name = new char[strlen(array[number].filename) + 5];
  strcpy(name, array[number].filename);
  ifstream bio(name, ios::in); //open bio
If it cant find the file it prints to the screen the name of the fiel it can't open. For some people I get just .txt, for some just a letter... I even got once a smily as the file
If I insert the number 6 wich isn't soupoused to exist anyway, it gives me most of the file I'm reading the addresses from! Including tabs and newlines. Any ideas anybody?