c_str is a function. You need to call it. You do that by putting parenthesis after it:
data.open(fname.c_str()); // put paranthesis here
EDIT:
also... getline(data,string);
The 2nd param you pass to getline is the variable you want to receive the line. 'string' is not a variable, it's a typename. You probably meant to do getline(data,fname); or something.