Commit bc8ce8f4 authored by Dominik Widhalm's avatar Dominik Widhalm
Browse files

Replaced manuel removal of \n with strtok function

parent 0e78210c
...@@ -89,14 +89,14 @@ person_t *person_new (addtype_t type, person_t *child) { ...@@ -89,14 +89,14 @@ person_t *person_new (addtype_t type, person_t *child) {
printf("Please enter %s's first name: ",query); printf("Please enter %s's first name: ",query);
/* Read in the user's input */ /* Read in the user's input */
fgets(new->firstname,STRING_MAX,stdin); fgets(new->firstname,STRING_MAX,stdin);
/* Remove newline from string */ /* Remove trailing newline */
new->firstname[strlen(new->firstname)-1] = '\0'; strtok(new->firstname,"\n");
/* Ask the user to enter the person's family name */ /* Ask the user to enter the person's family name */
printf("Please enter %s's family name: ",query); printf("Please enter %s's family name: ",query);
/* Read in the user's input */ /* Read in the user's input */
fgets(new->familyname,STRING_MAX,stdin); fgets(new->familyname,STRING_MAX,stdin);
/* Remove newline from string */ /* Remove trailing newline */
new->familyname[strlen(new->familyname)-1] = '\0'; strtok(new->familyname,"\n");
/* Initially set its Kekule number to 0 */ /* Initially set its Kekule number to 0 */
new->kekule = 0; new->kekule = 0;
/* Initially set its parent pointers to NULL */ /* Initially set its parent pointers to NULL */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment