microsoft/Terminal
Vedi su GitHubDon't printf wstring_views by copying them into wstrings; use `%.*s`!
Open
#4027 aperta il 19 dic 2019
Area-CodeHealthHelp WantedIssue-TaskProduct-ConhostProduct-Terminal
Metriche repository
- Star
- (35.764 star)
- Metriche merge PR
- (Merge medio 27g 19h) (24 PR mergiate in 30 g)
Descrizione
StringCchPrintf and--since C99--printf support a specifier that indicates that a string is counted:
auto size = /* ... */;
auto data = /* ... */;
printf("%.*s", size, data);
The .* suggests that printf should consume one register-width argument to determine how many characters the string that follows contains instead of waiting for a null terminator.