Lazarus
Free Pascal => Beginners => Topic started by: JLWest on April 01, 2023, 01:32:45 am
Title:
StrComp problem(Solved)
Post by:
JLWest
on
April 01, 2023, 01:32:45 am
Trying to compare two strings;
I don't understand what wrong with this.
Didn't know it mattered.
It compiled. I haven't tested it yet.
Sometimes just sName=sTag works and sometimes not. Wonder why?
Code: Pascal
[Select]
[+]
[-]
VAR
P1
:
PChar
;
P2
:
PChar
;
C
:
SizeInt
;
aName
,
aTag
:
String
;
begin
P1
:
=
sName
;
<<<duplicates
.
pas
(
243
,
10
)
Error
:
Incompatible types
:
got "AnsiString" expected "PChar"
p2
:
=
sTag
;
C
:
=
strcomp
(
P1
,
P2
)
;
Title:
Re: StrComp problem
Post by:
KodeZwerg
on
April 01, 2023, 01:36:55 am
I do not know why you hide your declaration of sName, anyway, "P1 := PChar(sName);" should solve your issue.
TinyPortal
© 2005-2018