Recent

Author Topic: [CLOSED] LoadFromFile() problem  (Read 248 times)

julkas

  • Hero Member
  • *****
  • Posts: 619
  • KISS principle / Lazarus 2.0.6 / FPC 3.0.4
[CLOSED] LoadFromFile() problem
« on: July 14, 2020, 10:45:04 am »
Following code (FPC 3.0.4) -
Code: Pascal  [Select][+][-]
  1.   ..
  2.   frDict := TStringList.Create();
  3.   frDict.LoadFromFile('enwiki-latest-all-titles-in-ns0', TEncoding.UTF8);
  4.   ..
  5.  

generates error -
Code: Bash  [Select][+][-]
  1. benchmark.lpr(193,73) Error: Wrong number of parameters specified for call to "LoadFromFile"
  2. Error: Found declaration: LoadFromFile(const AnsiString);
  3.  
Any hint ? (Delphi compiles without problem)
« Last Edit: July 14, 2020, 05:57:51 pm by julkas »
procedure mulu64(a, b: QWORD; out clo, chi: QWORD); assembler;
asm
  mov rax, a
  mov rdx, b
  mul rdx
  mov [clo], rax
  mov [chi], rdx
end;

Thaddy

  • Hero Member
  • *****
  • Posts: 10275
Re: LoadFromFile() problem
« Reply #1 on: July 14, 2020, 10:49:36 am »
Use 3.2.0 or trunk (full program):
Code: Pascal  [Select][+][-]
  1. {$mode delphi}{$H+}
  2. uses classes, sysutils;
  3. var
  4.   frDict:TStrings;
  5. begin
  6.   frDict := TStringList.Create();
  7.   frDict.LoadFromFile('enwiki-latest-all-titles-in-ns0', TEncoding.UTF8);
  8.   frDict.Free;
  9. end.

Works like a charm... 3.0.4 is now eol. You are using a feature - TEncoding - that is not in 3.0.4....
« Last Edit: July 14, 2020, 10:56:41 am by Thaddy »
I am more like donkey than shrek

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8564
  • FPC developer.

Thaddy

  • Hero Member
  • *****
  • Posts: 10275
I am more like donkey than shrek

 

TinyPortal © 2005-2018