Code:
int T;
char file[30];

FILE *fp;


if(argc <= 2)
{
	while(1)
	{
		printf("Please enter the number of threads to be created: ");
		if(scanf("%d", &T) == 1)
			{
			 
                            //stuff
                            break;			

                          }//end of if(scanf("%d", &T) == 1)
			else
			T = -2;
		
						
	}//end of while(true)
}//end of if(argc <= 2)
Ok, the probem is with scanf("%d", &T) == 1).
T is an integer.
If I input a string instead of an int, my program goes into an inifinit loop.
WHY???