Save a string in a file  

Send By: Uri
Web : N.A.
Email: uri@haley.es
Date: 16/04/00

Tip accessed 424 times

 


To record a String quickly to file and not to have us to tie with TStrings.SaveToFile, or with the FILE, REWRITE, etc, we can create a very simple function that makes it:


 Procedure StrToFile(Texte: String; Fitxer: String);
 var
   Stream: TStream;
 begin
   Stream := TFileStream.Create(Fitxer, fmCreate);
   try
     Stream.WriteBuffer(Pointer(Texte)^, Length(Texte));
   finally
     Stream.Free;
   end;
 end;