kernel/TextConsole: Add a write() function that accepts a fixed-size buffer instead of relying on null terminators
This commit is contained in:
parent
629ed9e43b
commit
d01ba20749
@ -172,6 +172,12 @@ namespace TextConsole
|
||||
return {};
|
||||
}
|
||||
|
||||
Result<void> write(const char* str, usize len)
|
||||
{
|
||||
while (len--) TRY(putchar(*str++));
|
||||
return {};
|
||||
}
|
||||
|
||||
void wprint(const wchar_t* str)
|
||||
{
|
||||
while (*str) putwchar(*str++);
|
||||
|
@ -14,6 +14,7 @@ namespace TextConsole
|
||||
u32 background();
|
||||
void move_to(u32 x, u32 y);
|
||||
Result<void> print(const char* str);
|
||||
Result<void> write(const char* str, usize len);
|
||||
void wprint(const wchar_t* str);
|
||||
Result<void> println(const char* str);
|
||||
void wprintln(const wchar_t* str);
|
||||
|
Loading…
Reference in New Issue
Block a user