Error 1 error C2440: '=' : cannot convert from 'const char [2]' to 'char'

bool word(char *Filename){

int r,number,length;

ifstream file;;


srand ( (unsigned)time ( NULL ) );
r=rand() % number+1;

string input,word;

for(int i=0; i<r; i++) getline(file,input);

for(int l=0;l<length;l++)word[l]="_";


return true;

In line 20, change "_" to '_'

After you solve that problem I found a new one.It is not in my error list.

Debug Assertion failed.
Expression string out of range.

On line 15, you define a variable named "word." Because that is a string variable, it is automatically initialized to an empty string--that is, a string with no characters in it.

I do not see any place in the code you posted where you give a different value to that variable, which means that it is always going to be an empty string.

In line 20, you execute the statement word[l]='_', which is legitimate only if word has at least "l" characters in it. But we have already established that word does not have any characters in it. Therefore, this statement will always fail.