devkitPro / libctru

Homebrew development library for Nintendo 3DS/Horizon OS user mode (Arm11)

Home Page:https://libctru.devkitpro.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FRD_GetMyScreenName() returning a char

EimaMei opened this issue · comments

Problem with the function is that you have to use a char pointer, which means the result with be only 1 letter. So if I used the function and the 3ds name is SaCode, it would output just s. Are any fixes/alternatives to this function?

commented
/**
 * @brief Gets the current user's screen name.
 * @param name Pointer to write the current user's screen name to.
 * @param max_size Max size of the screen name.
 */
Result FRD_GetMyScreenName(char *name, size_t max_size);

You need to pass a buffer of a certain size, like this:

char name[32];
Result rc = FRD_GetMyScreenName(name, sizeof(name));
if (R_SUCCEEDED(rc)) {
    print("Name is %s\n", name);
}