silly question, I can't print the sprite name.... #1679
-
I am sure it must be something stupid by I am trying to print the name of a sprite and I don't know how
This prints simbols. and getName() doesn't have .c_str(), so I am not sure how I can't figure out something so simple. thx |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Use |
Beta Was this translation helpful? Give feedback.
-
of course... thanks. |
Beta Was this translation helpful? Give feedback.
-
Oh never mind what I meant, I understand now with your explanation. |
Beta Was this translation helpful? Give feedback.
-
The problem here is the |
Beta Was this translation helpful? Give feedback.
Sorry, I don't understand what you mean by that.
It's not theory, but you're right that it's "light weight", since it's just a read-only reference to data, and doesn't actually hold a copy of the data. Plenty of info online about it.
In your specific use-case above, you're attempting to use a function (
log
) that accepts a null terminated character sequence, which has nothing to do withstd::string
orstd::string_view
. The need to convert thestring_view
to astring
first is because thestring_view
does not have a null terminator at the end of t…