Recent

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

julkas

  • Guest
[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 »

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
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 »
Specialize a type, not a var.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Specialize a type, not a var.

 

TinyPortal © 2005-2018