I am writing a program that will assign a unique code to a given requestor. The format will be *issuer initials (3 characters)* - *random 4-digit integer*-*date (format is last digit of year + 3-digit day of year (i.e.: 5 January 2020 = 00005))
I can create this to output to my screen using snprintf, but I need to assign it to a structure it (char).
Here is my code so far:
Code:
printf("Please enter the technician intials: ");
fgets(techInit, sizeof(techInit), stdin);
removeNL(techInit); // this is a function to remove the new line from the input
ppr = rand() % 10000;
snprintf(buf, 50, "%s-%d-%d", techInit, ppr, Julian);
printf("|%s|\n", buf); // this is just a test printf to check if it combined everything properly
I'm trying to assign the "buf" to a struct item (char) called "new->pprNum"