Load DOS text in a RichEdit without the lost of written accents  

Send By: Q3 Team
Web : www.q3.nu
Email: dlib@q3.nu
Date: 13/12/99

Tip accessed 588 times

 


Use the following code, that translates the text through the OemToAnsiBuff function:


  procedure TForm1.Button1Click(Sender: TObject);
    var
      i: integer;
      linea: PChar;
      txt: TStringList;
    begin
      txt := TStringList.Create;
      try
         txt.LoadFromFile('c:\Fichero\a\leer.txt');
         for i := 0 to txt.Count - 1 do
         begin
            linea := PChar(txt.strings[i]);
            OemToAnsiBuff(linea, linea, strlen(linea));
         end;
         RichEdit1.Lines.AddStrings(txt);
      finally
         txt.Free;
      end;
    end;




NOTE: OemToAnsiBuff is obsolete in Win32, but... it works. Look at the help.