0

この機能を使用しています

int spc_email_isvalid(const char *address) {


int        count = 0;
const char *c, *domain;
static char *rfc822_specials = "()<>@,;:\\\"[]";

/* first we validate the name portion (name@domain) */
for (c = address;  *c;  c++) {
if (*c == '\"' && (c == address || *(c - 1) == '.' || *(c - 1) == 
    '\"')) {
  while (*++c) {
    if (*c == '\"') break;
    if (*c == '\\' && (*++c == ' ')) continue;
    if (*c <= ' ' || *c >= 127) return 0;
  }
  if (!*c++) return 0;
  if (*c == '@') break;
  if (*c != '.') return 0;
  continue;
}
if (*c == '@') break;
if (*c <= ' ' || *c >= 127) return 0;
if (strchr(rfc822_specials, *c)) return 0;
}
if (c == address || *(c - 1) == '.') return 0;

/* next we validate the domain portion (name@domain) */
if (!*(domain = ++c)) return 0;
do {
if (*c == '.') {
  if (c == domain || *(c - 1) == '.') return 0;
  count++;
}
if (*c <= ' ' || *c >= 127) return 0;
if (strchr(rfc822_specials, *c)) return 0;
} while (*++c);

return (count >= 1);
}

私はすべての関数 AfxMessageBox(spc_email_isvalid("abcd@hot.com")); nullを返します

電子メール ID に基づいて値 o または 1 を取得する方法

4

1 に答える 1

1

AfxMessageBoxLPCTSTR最初のパラメータとして必要:

CString str;     
str.Format( _T("%d"), spc_email_isvalid("abcd@hot.com")); 

AfxMessageBox( str, MB_OK | MB_ICONINFORMATION );
于 2013-01-25T09:08:34.183 に答える