There a couple of different possibilities why your program is malfunctioning.
First you need to check to insure that your input file actually opened.
Second depending on the file format you may be having problems with dangling end of line characters left in the input stream. When you switch between the extraction operator>> and getline() you can have problems because of these dangling characters. If your file structure looks something like:
1 2 3
|
2
band name-song name, 10 10
band name-song name,20 20
|
You will have problems. Your first input would be retrieved, but it would leave the end of line character in the input buffer so the next input with getline would retrieve that character along with "band name", remember by default getline() doesn't always skip leading whitespace. So the resulting string would look like "\nband name", notice that the end of line character is at the beginning of the string so if you compare "band name" to "\nband name" the comparison would fail. To solve the problem you will need to extract and discard the leading whitespace characters. For this program you can extract the whitespace inside the getline() call
getline(fd >> ws, D[i].gr,'-');
There are other issues with your code that you should also fix, even though they don't "break" this program the issues should still be addressed.
First arrays in C++ start at zero and stop at size - 1. Your arrays are starting at one.
Second you should validate the variable "n" to insure it is less than or equal to the size of the array.
Third you really should use meaningful variable names. In a program of this size using single letter and non-meaningful variable names is not a big issue but as your programs grow, and they tend to grow quickly, your current variable names will get very confusing.
Fourth your indentation could use some work, consistent indentation makes reading your program much easier.