void good()
{
FILE *fp;
char name[20], phone[20];
puts("Win!");
printf("Your name: ");
scanf("%s", name);
printf("Your phone number: ");
scanf("%s", phone);
fp = fopen("/home/ving/winner_A","ab+");
fprintf(fp,"%s\t%s\n",name,phone);
fclose(fp);
}
void bad()
{
printf("I'm sorry, you're at %p and you want to be at %p\n", bad, good);
}
int main(int argc, char **argv)
{
void (*fp)(void) = bad;
char buffer[50];
if(argc != 2 || strlen(argv[1]) < 4)
return 0;
memcpy(buffer, argv[1], strlen(argv[1]));
memset(buffer, 0, strlen(argv[1]) - 4);
fp();
return 0;
}