Hi,
I’m writing a program that needs to read a list of command lines either from keyboard or from a file.
Each command line should be correspoding to a drawing funcion, such as drawline, drawcircle …etc.
The input parameter should look like “< FileName.in”
Currently, I’m writint the program by using “glutIdleFunc(commandInput)”
The testing code for commandInput is:
===============================
void commandInput(void){
char command[100];
if (IfReadFile==0)
{
ReadFile();
IfReadFile=1;
}
cout<<"Enter command:
";
cin.getline(command,100, '
');
if (strcmp(command,"square")==0)
{
cout<<"Enterd Square
";
drawSquare();
}
/else
{
cout<<"Compare fail
";
}/
}
===========================================
But, I found out the input parameters keep on messing up the commandInput program.
Is anyone can help me find the problem?
Or, is there anyway to write this program except the method I’m trying to use?
Thanks!