Skip to main content
gamedev.net
🔒 Locked

stupid errors

Started by MrPoopypants May 17, 2003 at 8:41 PM 5 replies 450+ views
Original Post
MrPoopypants
MrPoopypants
why is it giving me: error C2143: syntax error : missing '')'' before ''='' error C2660: ''open'' : function does not take 0 parameters error C2143: syntax error : missing '';'' before '','' error C2059: syntax error : '')'' when i do
ifstream DataInFile;

/*errors points to this line*/DataInFile.open( DBLOCATION, ios::nocreate );
 
this same code works in another program flawlessly
(0110101101000110)The Murphy Philosophy: Smile . . . tomorrow will be worse.
brain21
brain21
Ok, the first error line indicates that there is an ''='' sign somewhere and the code you are showing does not. Can you show us more code??
MrPoopypants
MrPoopypants
here is the entire function (which works perfectly from the last program):


void GetArtistFromFile( int iNumArtists , char sArtist [] )
{
ifstream DataInFile;

DataInFile.open( DBLOCATION, ios::nocreate );
if ( DataInFile.fail() )
{
cout << "Fatal Error! Artists input file could not be opened." << endl;
exit(0);
}
// file open ...


while ( !DataInFile.eof() )
{
if ( iNumArtists == ARRAYSIZE )
{
cout << "Fatal Error! Maximum number of Artists exceeded." << endl;
DataInFile.close();
exit(0);
}

DataInFile.getline ( sArtist, MAXLEN ); // file i/o to string
if ( strcmp ( sArtist, "" ) == 0 )
{
continue; // blank entry
}

cout << sArtist << endl;

iNumArtists++;
}
return;
}
(0110101101000110)The Murphy Philosophy: Smile . . . tomorrow will be worse.
dorix
dorix
Show us the line where DBLOCATION is #defined. I''m guessing you did it like this:

#define DBLOCATION="C:\\Path\\To\\DB";

If that''s the case, then that would be your problem. Change that line to:

#define DBLOCATION "C:\\Path\\To\\DB"

Note: without an equal sign, or semicolon.
If that wasn''t it, please show us the #define DBLOCATION line anyways, because I suspect that''s actually where your problem is.
Anonymous Poster could also be right about having missed a closing ) or } somewhere above too.

- dorix


MrPoopypants
MrPoopypants
yes! dorix you saved my life!

DAMN how couldnt i notice that?!?!
(0110101101000110)The Murphy Philosophy: Smile . . . tomorrow will be worse.
Qw3r7yU10p!
Qw3r7yU10p!
macro evil

use:
const std::string DBLOCATION = "C:\\Path\\To\\DB";

or:
const char* DBLOCATION = "C:\\Path\\To\\DB";

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.