Beispiel #1
0
Employee* userEmployee() {
  
  char* emp_name; /* hold entered name */
  char* emp_sal; /* hold entered salary of type string */
  char* emp_dept; /* hold entered deparment */
  int emp_salary; /* hold entered salary of type int */
  
  printf("New Employee Information Entry.\n");
  emp_name = readline("Please enter Employee's name: ");
  emp_sal = readline("Please enter Employee's salary: ");
  while(stringCheck(emp_sal) == 0) {
    free(emp_sal);
    emp_sal = readline("Incorrect Input. Please try again: ");
  }
  emp_salary = atoi(emp_sal);
  emp_dept = readline("Please enter Employee's department: ");

  /* create the Employee struct with the user entered data as params */
  Employee* user_emp = createEmployee( emp_salary, emp_name, emp_dept );

  free(emp_sal); /* free the salary string */
  free(emp_name); /* free the name string */
  free(emp_dept); /* free the department string */

  return user_emp; /* return the newly allocated Employee with user data */
} /* end function userEmployee */
Beispiel #2
0
void bufferCheck()
{
	if(findRinBuff() > 0)
	{
		if(stringCheck("RING") == 1)
		{
			uart_puts("ATH\r");
		}

		if(stringCheck("+CLCC: 1,1,6,") == 1)
		{

			if(!(PINC && (1 << PC2)) || stringBuffer[24] != '"') // jeśli jest wpisany opis albo tryb wpuszczaj wszystkich
			{
				openGate();
			}

		}

		bufferLength = 1;
	}
}