Skip to content

Add Account

AddAccount

Adds a new account to the system using the provided account parameters.

int AddAccount(const AccountRecord& source_account);

Parameters

  • source_account — constant reference to an AccountRecord structure containing the account parameters to be added.

Return Value

  • RET_OK — account successfully added.
  • RET_* — error code if the account creation fails.
  • Return Codes

Example

AccountRecord acc = {};
acc.login = 1002;
acc.group = "demo";
acc.name = "John Doe";
acc.password = "securePass123";
acc.email = "[email protected]";

if (AddAccount(acc) == RET_OK) {
    // Account added successfully
}

Warning

  • The source_account parameters must be valid and meet system requirements.
  • Ensure the login ID is unique before calling this function.
  • Always check the return code to confirm the account was created successfully.