devkitPro/libctru

FRD_GetMyScreenName() returning a char

EimaMei opened this issue · 1 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?

fincs 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);
}