I keep getting the following error upon compiling:
c:\c++ files\programs\stellardebug\unitcode.h(677) : error C2664:
'class istream &__thiscall istream::getline(char *,int,char)' : cannot
convert parameter 1 from 'const char *' to 'char *'
Conversion loses qualifiers
I have a data file called Standard.udf
The Data File (not the problem): The data in the file is in text
format, and was created using a function in this program with fout.
Using notepad, I know the data file is not the problem. FYI: The
first line of data is "***************************************" and I
just want to skip it and go on to the next one.
Here is the problem function:
int UnitDef_Load(string sFileName)
{
int iERRORCODE = ERR_NONE;
iERRORCODE = UnitDefCleanList(false); // cleans linked list
if(iERRORCODE == ERR_NONE)
{
ifstream fin(sFileName.c_str());
if (!fin) // checks for file
{
return ERR_UNABLE_TO_OPEN; // error checking
}
else
{
// HERE IS THE CODE LOADING THE HEADER DATA!!!!
string Temp;
fin.getline(Temp,255); // PROBLEM LINE
};
fin.close();
}; // end if
return iERRORCODE;
};
I have tried everything I know to get this to work (I have been away
from c++ for awhile... just now getting back to it).
Could someone please explain how to make this work? (I have spent
hours online looking for examples, but have not found one that works).
Thank you.