here is the code
Code: Select all
/* Logs 0.1
Tuesday, September, 1:57 pm, 2004
Logs logins.
thats about it...
*/
#include <stdio.h>
#include <time.h>
FILE CreateLog(char filename[]);
void Log(char string[]);
char GetDateTime(char string[]);
int Password(void);
main()
{
Password();
}
/* Function CreateLog definition */
FILE CreateLog(char filename[])
{
FILE *fptr;
fptr = fopen(filename, "a+");
return *fptr;
}
/* Function Log definition */
void Log(char string[], FILE *fptr)
{
fputs(string, fptr);
}
/* Function GetDateTime definition */
char GetDateTime(void)
{
time_t timeT;
char string[90];
time(&timeT);
asctime(localtime(&timeT));
*string = timeT;
return *string;
}
/* Function Password definition */
int Password(void)
{
char pass[8], string[90], filename[] = "Login.log", LogS[90], TESTLOG[] = "TEST";
FILE *fptr;
int reval, c;
*fptr = CreateLog(filename);
*LogS = GetDateTime();
printf("Enter password.\n", pass);
scanf("%s", &pass);
printf("pass = %s", pass);
if (pass == "123"){
printf("Access granted.\nLogin clear.\n");
printf("Ready? (Y/N)\n");
while(c != 'Y'){
c = getc(stdin);
}
reval = 1;
} else {
Log(TESTLOG, fptr);
printf("Access denied.\nLogin attempt has been loged.\n");
printf("Ready? (Y/N)\n");
while(c != 'Y'){
c = getc(stdin);
}
reval = 0;
}
return reval;
}
me a error. but if i change it to a for statement it dosnt.
any one know whats up?