示例#1
0
文件: posix.cpp 项目: Zoxc/mirb
		CharArray NativeStream::read(size_t length)
		{
			CharArray buf;
			buf.buffer(length);

			ssize_t result = ::read(fd, buf.str_ref(), buf.size());

			if(result < 0)
				raise("Unable to read from file descriptor");

			buf.shrink((size_t)result);
			return buf;
		}
 void  format(CharArray<ENC,LEN>& txt, const encoding_char_t<ENC>* str, LocaleId locale = LocaleId::Neutral) const
 {
   // Format date according to user settings
   if (!WinAPI<ENC>::getDateFormat(locale, enum_cast(zero<DateFlags>()), base_cast(this), str, txt.buffer(), LEN))
     throw platform_error(HERE, "Unable to format date");
 }
 void  format(CharArray<ENC,LEN>& txt, DateFlags flags, LocaleId locale = LocaleId::Neutral) const
 { 
   // Format date according to user settings
   if (!WinAPI<ENC>::getDateFormat(locale, enum_cast(flags), base_cast(this), nullptr, txt.buffer(), LEN))
     throw platform_error(HERE, "Unable to format date");
 }