Forum > Other

Compile Error on Assign for Search Files

(1/6) > >>

turunk:
i wanted to search with files, but i got the error "Finderror1.lpr(20,18) Error: Can't determine which overloaded function to call" ,
2 times assign had no given error but then he gave this error, see:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Program Finderror1;   Uses Dos;   Var F1,F2:Text;    F3:Text;    T1:String;    Find:SearchRec;    FA:Byte; Begin  AsSign(F1,'A.Txt');ReSet(F1);  ReadLn(F1,T1);  AsSign(F2,'B.Txt');ReWrite(F2);  FindFirst(T1,$3F,Find);  Repeat    If FA=0      Then Begin WriteLn(F2,'FA is 0');                 FindNext(Find);End      Else Begin AsSign(F3,Find.WinFindData.cFileName);                 ReSet(F3);                 Close(F3);    End;  Until Dos.DosError=18;  Close(F1);Close(F2);  FindClose(Find);End. 

speter:
G'Day turunk,

1) Variable "FA" is not initialised. Did you mean to write:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---FA := FindFirst(T1,$3F,Find);2) With SearchRec type variables, I use find.filename for the matching filename...!?

cheers
S.

cdbc:
Hi
These 2 DON'T MIX: "Find.WinFindData.cFileName" & "Find:SearchRec;"
Instead you should use 'Find.Name'.
Look in the FPC Wiki or documentation, for examples on how to do the search properly...
Regards Benny

turunk:
no, the problem is the 3rd assign.
fa has not to be initialized.
if i compile he makes no problem at 1st and 2nd assign.
Find.WinFindData.cFileName is for the long names.

cdbc:
Hi
This compiles for me (on Linux):
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---program find_errors;   Uses Dos;   Var F1,F2:Text;    F3:Text;    T1:String;    Find:SearchRec;    FA:Byte; begin  Assign(F1,'A.Txt'); Reset(F1);  ReadLn(F1,T1);  AsSign(F2,'B.Txt');ReWrite(F2);  FindFirst(T1,$3F,Find);  Repeat    If FA=0      Then Begin WriteLn(F2,'FA is 0');                 FindNext(Find);End      Else Begin AsSign(F3,Find.Name); //<-- ONLY CHANGE!                 ReSet(F3);                 Close(F3);    End;  Until Dos.DosError=18;  Close(F1);Close(F2);  FindClose(Find);end.Regards Benny

Navigation

[0] Message Index

[#] Next page

Go to full version