stringbuffer.dpr 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. (* _ _
  2. * | |__ _ __ ___ ___ | | __
  3. * | '_ \| '__/ _ \ / _ \| |/ /
  4. * | |_) | | | (_) | (_) | <
  5. * |_.__/|_| \___/ \___/|_|\_\
  6. *
  7. * Microframework which helps to develop web Pascal applications.
  8. *
  9. * Copyright (c) 2012-2020 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. {$IFDEF MSWINDOWS}
  27. {$APPTYPE CONSOLE}
  28. {$ENDIF}
  29. uses
  30. SysUtils,
  31. Classes,
  32. BrookString;
  33. const
  34. fn = 'test.txt';
  35. var
  36. sb: TBrookString;
  37. f: TBytesStream;
  38. begin
  39. sb := TBrookString.Create(nil);
  40. try
  41. sb.Write('abc');
  42. sb.WriteBytes(TBytes.Create(49, 50, 51), 3);
  43. WriteLn('Text: ', sb.Text);
  44. f := TBytesStream.Create(sb.Content);
  45. try
  46. f.SaveToFile(fn);
  47. WriteLn('File saved: ', fn);
  48. finally
  49. f.Free;
  50. end;
  51. {$IFDEF MSWINDOWS}
  52. ReadLn;
  53. {$ENDIF}
  54. finally
  55. sb.Free;
  56. end;
  57. end.