На главную Наши проекты:
Журнал   ·   Discuz!ML   ·   Wiki   ·   DRKB   ·   Помощь проекту
ПРАВИЛА FAQ Помощь Участники Календарь Избранное RSS
msm.ru
Модераторы: jack128, Rouse_, Krid
  
    > Перекодировка текста из WIN в DOS , и наоборот
      WIN -> DOS
      ExpandedWrap disabled
        function AnsiToOemStr(const AnsiStr: string): string;
        begin
          SetLength(Result, Length(AnsiStr));
          if Length(Result) > 0 then
            CharToOemBuff(PChar(AnsiStr), PChar(Result), Length(Result));
        end;
         
        procedure TForm1.Button2Click(Sender: TObject);
        var
          LIn, LOut: TStringList;
        begin
          LIn := TStringList.Create;
          LOut := TStringList.Create;
          try
            LIn.LoadFromFile('readmewin.txt');
            LOut.Text := AnsiToOemStr(LIn.Text);
            LOut.SaveToFile(ExtractFilePath(ParamStr(0)) + 'readmedos.txt');
          finally
            LIn.Free;
            LOut.Free;
          end;
        end;


      DOS -> WIN
      ExpandedWrap disabled
        function OemToAnsiStr(const OemStr: string): string;
        begin
          SetLength(Result, Length(OemStr));
          if Length(Result) > 0 then
            OemToCharBuff(PChar(OemStr), PChar(Result), Length(Result));
        end;
         
        procedure TForm1.Button1Click(Sender: TObject);
        var
          LIn, LOut: TStringList;
        begin
          LIn := TStringList.Create;
          LOut := TStringList.Create;
          try
            LIn.LoadFromFile('testdos.txt');
            LOut.Text := OemToAnsiStr(LIn.Text);
            LOut.SaveToFile(ExtractFilePath(ParamStr(0)) + 'readmewin.txt');
            //Memo1.Lines.Assign(LOut);
          finally
            LIn.Free;
            LOut.Free;
          end;
        end;
      0 пользователей читают эту тему (0 гостей и 0 скрытых пользователей)
      0 пользователей:


      Рейтинг@Mail.ru
      [ Script execution time: 0,0150 ]   [ 16 queries used ]   [ Generated: 27.04.24, 08:50 GMT ]