codice:void getline(char *pStr, size_t maxBytes){ if(pStr == NULL) return; while((*pStr++ = getchar()) != '\n' && maxBytes-- >= 0) ; /*Oppure usa fflush(stdin)*/ if(maxBytes <= 0){ while(!getchar()); } *pStr = '\0'; }![]()
codice:void getline(char *pStr, size_t maxBytes){ if(pStr == NULL) return; while((*pStr++ = getchar()) != '\n' && maxBytes-- >= 0) ; /*Oppure usa fflush(stdin)*/ if(maxBytes <= 0){ while(!getchar()); } *pStr = '\0'; }![]()