|
发表于 2024-3-7 12:29:18
|
显示全部楼层
// 不可缺少!
#pragma module_name = "?__write"
size_t __write(int handle, const unsigned char * buffer, size_t size)
{
size_t nChars = 0;
if (buffer == 0)
{
//
// This means that we should flush internal buffers. Since we
// don't we just return. (Remember, "handle" == -1 means that all
// handles should be flushed.)
return 0;
}
// This template only writes to "standard out" and "standard err",
// for all other file handles it returns failure.
if (handle != _LLIO_STDOUT && handle != _LLIO_STDERR)
{
return _LLIO_ERROR;
}
for (; size != 0; --size)
{
TerminalSerial_WrByte(*buffer++);
// if (TerminalSerial_WrByte(*buffer++) < 0)
// {
// return _LLIO_ERROR;
// }
++nChars;
}
return nChars;
}
|
|