stringbuffer.lpr 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. (* _ _
  2. * | |__ _ __ ___ ___ | | __
  3. * | '_ \| '__/ _ \ / _ \| |/ /
  4. * | |_) | | | (_) | (_) | <
  5. * |_.__/|_| \___/ \___/|_|\_\
  6. *
  7. * Microframework which helps to develop web Pascal applications.
  8. *
  9. * Copyright (c) 2012-2021 Silvio Clecio <[email protected]>
  10. *
  11. * Brook framework is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU Lesser General Public
  13. * License as published by the Free Software Foundation; either
  14. * version 2.1 of the License, or (at your option) any later version.
  15. *
  16. * Brook framework is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * Lesser General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Lesser General Public
  22. * License along with Brook framework; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. *)
  25. program stringbuffer;
  26. {$MODE DELPHI}
  27. uses
  28. SysUtils,
  29. Classes,
  30. BrookString;
  31. const
  32. fn = 'test.txt';
  33. var
  34. sb: TBrookString;
  35. f: TBytesStream;
  36. begin
  37. sb := TBrookString.Create(nil);
  38. try
  39. sb.Write('abc');
  40. sb.WriteBytes(TBytes.Create(49, 50, 51), 3);
  41. WriteLn('Text: ', sb.Text);
  42. f := TBytesStream.Create(sb.Content);
  43. try
  44. f.SaveToFile(fn);
  45. WriteLn('File saved: ', fn);
  46. finally
  47. f.Free;
  48. end;
  49. {$IFDEF MSWINDOWS}
  50. ReadLn;
  51. {$ENDIF}
  52. finally
  53. sb.Free;
  54. end;
  55. end.