TresCom Forums

TresCom : The Trespasser Fan Gateway...
It is currently Sun Jun 24, 2018 4:39 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Thu Sep 23, 2004 2:03 am 
Offline
Pteranodon
Pteranodon

Joined: Wed Sep 10, 2003 11:18 pm
Posts: 983
uh will thats about it.....
here is the code

Code:
/* 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;
}


in the "Password" function declaration the while statement gives
me a error. but if i change it to a for statement it dosnt.

any one know whats up?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 23, 2004 2:55 am 
Offline
Parasaurus
Parasaurus

Joined: Sun Mar 28, 2004 7:33 am
Posts: 45
same error occur when password is correct?
can you step through the code at runtime? If so what happens just after the while?

I dunno much bout C or C++ and my programming is 5 years rusty...
Hope this helps a bit.

_________________
"I dream for a living." - Steven Spielberg


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 23, 2004 10:23 pm 
Offline
Pteranodon
Pteranodon

Joined: Wed Sep 10, 2003 11:18 pm
Posts: 983
at build time i get this error.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 7:53 am 
Offline
-=TresCom Developer=-
-=TresCom Developer=-

Joined: Mon Jul 22, 2002 12:35 pm
Posts: 1845
Location: Holland, Europe
What kind of error?

_________________
http://www.bytehazard.com


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 5:37 pm 
Offline
Pteranodon
Pteranodon

Joined: Wed Sep 10, 2003 11:18 pm
Posts: 983
Thread stopped
C:\BC5\BIN\Logs.exe: Fault:
access violation at 0x401136:
write of address 0x0


ok only


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB® Forum Software © phpBB Group