Недавно добавленные исходники

•  DeLiKaTeS Tetris (Тетрис)  4 836

•  TDictionary Custom Sort  6 829

•  Fast Watermark Sources  6 606

•  3D Designer  9 575

•  Sik Screen Capture  6 948

•  Patch Maker  7 393

•  Айболит (remote control)  7 344

•  ListBox Drag & Drop  6 201

•  Доска для игры Реверси  98 195

•  Графические эффекты  7 517

•  Рисование по маске  6 800

•  Перетаскивание изображений  5 654

•  Canvas Drawing  6 034

•  Рисование Луны  5 825

•  Поворот изображения  5 274

•  Рисование стержней  3 867

•  Paint on Shape  3 020

•  Генератор кроссвордов  3 980

•  Головоломка Paletto  3 154

•  Теорема Монжа об окружностях  3 995

•  Пазл Numbrix  2 636

•  Заборы и коммивояжеры  3 448

•  Игра HIP  2 362

•  Игра Go (Го)  2 280

•  Симулятор лифта  2 676

•  Программа укладки плитки  2 239

•  Генератор лабиринта  2 794

•  Проверка числового ввода  2 399

•  HEX View  2 735

•  Физический маятник  2 427

 
скрыть

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



Оформил: DeeCo

{ 
 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;