-
my if statements
i cant find my problem, it says "missing ) before string"
but i think i have all my ')' 's
Code:
if((convert == "edit") || (convert == "Edit") || (convert == "EDIT"))
{
edit_file.open(tfilename.c_str(), ios::app);
cho = 1;
goto theend;
}
else if((convert == "new") || (convert == "New") || (convert == "NEW"))
{
new_file.open(tfilename.c_str());
cho = 2;
goto theend;
}
else if((convert == "read") || (convert == "Read") || (convert "READ"))
{
read_file.open(tfilename.c_str(), ios::in);
cho = 3;
goto theend;
}
else if((convert == "exit") || (convert =="Exit") || (convert == "EXIT"))
{
cho = 4;
goto theend;
}
o yea, on a side note,,,would this work , right after this
Code:
cho = (int)convert.c_str()[0];
-
should be
Code:
else if((convert == "read") || (convert == "Read") || (convert == "READ"))
Kurt
-
>> would this work
That would assign the character set value for the first character in the convert string to cho. If convert is "new" and you're using ASCII, then cho would be 110. If convert was "read" it would be 114. If convert was empty and you left the c_str() there, cho would be 0 (if convert is not empty you don't need the c_str(), since you can use [] on a string just like a character array). If that's what you want, then it would "work".