#include <stdio.h>
#include <string.h>
main()
	{
	FILE *inbuf;
	int code;
	int count;
	char infile[99], outfile[99];
	char u_fname[99], u_lname[99], u_password[99], u_time1[99];
	char u_date1[99], u_time2[99], u_date2[99], u_city[99];
	char l_m_base[5], l_f_base[5], xprt[3], toggle[3];
	printf("\nInput the full path name of the user file: ");
	scanf("%s", infile);
	printf("\n");
	if((inbuf = fopen(infile, "r" )) == NULL)
		{
		printf("\n\rError opening users file.\n\r");
		exit(1);
		}
	while(1)
		{
		code = fscanf(inbuf,"%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~%[^~]~\n",
			u_fname, u_lname, u_password, u_time1, u_date1,
			u_time2, u_date2, u_city, l_m_base, l_f_base, xprt, toggle);
		if(code < 12 ) break;
		term_space(u_fname);
		term_space(u_lname);
		term_space(u_city);
		term_space(u_time2);
		term_space(u_date2);
		printf("%s %s from %s was last on at %s on %s\n",u_fname,u_lname,u_city,u_time2,u_date2);

		}
	fclose(inbuf);
	}
term_space(adr) char *adr;
	{
	int l;
	char *str_ptr;
	str_ptr = adr;
	l = strlen(adr);
	str_ptr = str_ptr + l - 1;
	while (str_ptr >= adr)
		{
		if( *str_ptr != ' ')return;
		*str_ptr-- = '\0';
		}
	}
