Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения
KANSoftWare

Несколько функций для TStream

Delphi , Компоненты и Классы , Потоки

Несколько функций для TStream

Оформил: DeeCo
Автор: http://www.swissdelphicenter.ch

{ 
 These are three utility functions to write strings to a TStream. 
 Nothing fancy, but I just ended up coding this repeatedly so 
 I made these functions. }

 { 
 Hier sind einige TStreaam Hilfsfunktionen um strings 
 in einen TStream zu schreiben. 
}


 unit ClassUtils;

 interface

 uses
   SysUtils,
   Classes;

 {: Write a string to the stream 
   @param Stream is the TStream to write to. 
   @param s is the string to write 
   @returns the number of bytes written. }
 function Writestring(_Stream: TStream; const _s: string): Integer;

 {: Write a string to the stream appending CRLF 
   @param Stream is the TStream to write to. 
   @param s is the string to write 
   @returns the number of bytes written. }
 function WritestringLn(_Stream: TStream; const _s: string): Integer;

 {: Write formatted data to the stream appending CRLF 
   @param Stream is the TStream to write to. 
   @param Format is a format string as used in sysutils.format 
   @param Args is an array of const as used in sysutils.format 
   @returns the number of bytes written. }
 function WriteFmtLn(_Stream: TStream; const _Format: string;
   _Args: array of const): Integer;

 implementation

 function Writestring(_Stream: TStream; const _s: string): Integer;
 begin
   Result := _Stream.Write(PChar(_s)^, Length(_s));
 end;

 function WritestringLn(_Stream: TStream; const _s: string): Integer;
 begin
   Result := Writestring(_Stream, _s);
   Result := Result + Writestring(_Stream, #13#10);
end;

function WriteFmtLn(_Stream: TStream; const _Format: string;
   _Args: array of const): Integer;
 begin
   Result := WritestringLn(_Stream, Format(_Format, _Args));
 end;

Статья Несколько функций для TStream раздела Компоненты и Классы Потоки может быть полезна для разработчиков на Delphi и FreePascal.


Комментарии и вопросы


Ваше мнение или вопрос к статье в виде простого текста (Tag <a href=... Disabled). Все комментарии модерируются, модератор оставляет за собой право удалить непонравившейся ему комментарий.

заголовок

e-mail

Ваше имя

Сообщение

Введите код




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Потоки ::


реклама



©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru Rambler's Top100
20.04.2024 01:53:32/0.040194034576416/2