building the select_user_name() function

This commit is contained in:
Calson Noah 2017-05-21 22:46:43 +01:00
parent 09cf019740
commit e7b911a39a

View File

@ -734,4 +734,27 @@ long int select_user(void)
exit(EXIT_FAILURE);
}
}
/*Reads pariticular user information and stores in a global static variable user_info
using the fact that the end of each user information ends in new line*/
void get_user_name(void)
{
char name_ch;
u=0;
char ch;
FILE *fp;
if((fp=fopen("./speed/user_speed.info","r"))==NULL)
{
fprintf(stderr, "%s\n", "Fatal Error, Some files are missing");
exit(EXIT_FAILURE);
}
while((name_ch=getc(fp))!='\n')
putchar(name_ch);
//printf(""RESET"\n");
if(fclose(fp))
{
fprintf(stderr, "%s\n", "Fatal Error, Unable to close some files\n");
exit(EXIT_FAILURE);
}
}