C++, c1001 line 2701 error. HELP!

Bigfoot

New member
c1001 error, line 2701 is msc1.ccp. Heres my code:

bool next_file()
{
//moving to next filenum
current.filenum++;

//need dummy filenum
int dumnum = current.filenum;

//preparing divisor
int mult = 1;
int i;
for (i = current.file_firstnum; i < current.file_lastnum; i++)
mult = mult*10;

//changing current.filename
for (i = current.file_firstnum; i <= current.file_lastnum; i++)
{
if (dumnum/div > 0) //c++ compiler error?!
{
current.filename = dumnum/div + 48;
dumnum = dumnum - (dumnum/div)*div;
div = div/10;
}
else
{
current.filename = 48;
div = div/10;
}
}

//checking file exists
ifstream checksFile;
checksFile.open(current.filename, ios::in);
if (checksFile.fail())
return 0;
else
{
checksFile.close();
return 1;
}
}

This is just one function, I get the error on the first if after the main for statement: "if (dumnum/div > 0)".

The code looks clean to me, but obviously I'm missing something. Program compiles fine without this function, but unfortunately I *need* this function. Any suggestions?
 
Figured it out. I had copied some code from one of my other programs, and at the same time had declared mult in place of div. Since no div was declared, and cmath.h was included, the compiler thought I was using the function div.

Anyways, thanks for the link. I've looked at a bunch of those sites, and they mostly describe the error in terms I don't quite understand.
 
Back
Top