eh you're right about the pointers (it works with an int)... but I want to use a character array.
How might I do this?
right now, my newest code is this:
Code:
istream& operator >>(istream & is, any & operand)
//precondition: input stream is open for reading
//postcondition: the next string from input stream is has been read
// and stored in operand
{
char temp[81]; // not longer than screen length
char ch;
int i = 0;
while (i <= 80 && is.get(ch) && ch != '\n')
temp[i++] = ch;
temp[i] = '\0';
//cout << any_cast<char*>(operand) << endl;
if (strcmp(operand.type().name(),"int")==0)
operand = atoi(temp);
else if (strcmp(operand.type().name(),"float")==0 || strcmp(operand.type().name(),"double")==0)
operand = atof(temp);
else
operand = temp;
return is;
}