Re: Problem with EMail Registration Code

From: RK (rlkm4@YAHOO.COM)
Date: 01/09/02

grep buf db.h
/* global buffering system */
char    buf[MAX_STRING_LENGTH];
char    buf1[MAX_STRING_LENGTH];
char    buf2[MAX_STRING_LENGTH];

I'm still using global buffers so that in db.h is buf, buf1, buf2..etc
and the whole family of "hated" globals. I've pulled out all of the
mail things to the following function:

void send_email(int code, char *arg)
  FILE *fl;
  char filename[MAX_STRING_LENGTH];

  sprintf(buf, "%s%i", register_body, code);
  sprintf(filename, "reg.txt");


  if (!(fl = fopen(filename, "w")))
     log("Error opening registration file.");

  if (!fl) {
     log("Error opening registration file.");

  if (fclose(fl)) {
     log("Error closing registration file.");
  log ("Done opening file");
  log (buf);
  fprintf(fl, "%s", buf);

  sprintf(buf, "elm -s %s %s < reg.txt", register_subject, arg);

 //  unlink("reg.txt");


"code" is the numeric random password generated.
"arg" is the argument/email given

I made an ingame command that takes 1 argument and passes it to this
function and uses an arbitrary "code" value just to test to see if the
function works.

  send_email(54321, argument);

I type (ingame): test

I goto my email box and find my email in my box, but its blank.
I go to check the reg.txt, and its blank too. I then try any command
in game and it crashes (not if I just hit enter repeatedly, I get the
prompt again and again).

I tried to make a new character using this same function, but it
crashes before anything happens.

Suggestions? Does anyone know any similar snippets that do work or
have less problems?

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT