hi all
i have just finished this small program to log who made a connection along with the time and date.
Code:
#include <time.h>
#include <windows.h>
#include <stdio.h>
void main(int)
{
char datebuf[9]; //time and date
char timebuf[9];
char temp[2]; //buffer to swap dd/mm
TCHAR buff[256]; //user name
DWORD size = 256;
char filename[15];
strcpy(filename,"H:/Dialup.log"); //this is the location to save to
FILE *fptr; //file pointer
_strdate(datebuf); //get time and date
_strtime(timebuf);
GetUserName(buff,&size); //get logged on user
temp[0] = datebuf[0]; //to sort from mm/dd/yy to dd/mm/yy
temp[1] = datebuf[1];
datebuf[0] = datebuf[3];
datebuf[1] = datebuf[4];
datebuf[3] = temp[0];
datebuf[4] = temp[1];
if((fptr=fopen(filename,"a"))==NULL) /*amend*/
{
printf("Error: File %s could not be created.\n\a",filename);
printf("Check the disk is not full or protected.\n");
/*buzzer if error*/
}
fprintf(fptr,"User: %s\t\tDate: %s\tTime: %s\n",buff,datebuf,timebuf);
fclose(fptr);
}
however i dont know how to make C exe a dial up connection.
also a dial up has a strange location eg. {262480y48rwhdqw8eryq23}
or an easier way whould be to attch the c program to the dial up so that if the dial up is clicked on it will also run the above C program, but i dont know how to do that either.
hope you can help
thx