Printf-like assignment method for BString.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40695 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
9f0f6fcd99
commit
c91c2de735
@ -424,6 +424,25 @@ BString::AdoptChars(BString& string, int32 charCount)
|
||||
}
|
||||
|
||||
|
||||
BString&
|
||||
BString::SetToArguments(const char *format, ...)
|
||||
{
|
||||
va_list arg;
|
||||
va_start(arg, format);
|
||||
int32 bytes = vsnprintf(LockBuffer(0), 0, format, arg);
|
||||
va_end(arg);
|
||||
UnlockBuffer(0);
|
||||
|
||||
va_list arg2;
|
||||
va_start(arg2, format);
|
||||
bytes = vsnprintf(LockBuffer(bytes), bytes + 1, format, arg2);
|
||||
va_end(arg2);
|
||||
UnlockBuffer(bytes);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - Substring copying
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user