Is there something wrong with this function?
Ive been getting an illegal error in a program, and ive tracked it down to this function (and a certain line), so can someone tell me if there is a memory leak or another problem that would be causing the problem? Thanks.
Code:
int a_dll_written(char *dll_line)
{
ifstream i_dll("dll.txt");
char *new_line=new char[256]; //This line is where the error is caused at, and this function is called a lot in the program, so it might be a leak?
memset(new_line,'\0',256);
int r_val=0;
while(!i_dll.eof())
{
i_dll.getline(new_line,256,'\n');
if(strcmpi(new_line,dll_line)==0) r_val=1; //return 1 if theyre equal
}
i_dll.close();
delete new_line;
return r_val;
}