I am writing a C program to generate userid's from a given file (users
). The file has each user's first and last names each line (eg. "John Smith", "Steve Mathews" etc). The following while
loop reads each line from users
and prints in the console in all lowercase. In this case, single_line
holds names in lower case.
while(!feof(fp)) {
fgets(single_line, 80, fp);
for(int i = 0; single_line[i]; i++){
single_line[i] = tolower(single_line[i]);
}
char f_letter = single_line[0];
char r_letters[20];
}
Now, I want to create a username for each single_line
with the first letter of the first name and remaining letters of last name. So far, f_letter
holds the first letter of first name, how can I make r_letters
hold the remaining letters of last name?