[fpc-pascal] AnsiCompareStr question (again...)

Bart bartjunk64 at gmail.com
Sat Mar 5 13:01:38 CET 2016

On 3/5/16, Marcou Gilles <g.marcou at unistra.fr> wrote:

> I checked the AnsiCompareStr value between these two string and found
> that the same unit compiled into one application give the value 16 and
> compiled into the other application, it return the value -28.

{$apptype console}
{$ifdef fpc}
{$mode objfpc}
//{$codepage utf8}

uses SysUtils;
  S1,S2: AnsiString;

  S1 := 'C-C';
  S2 := 'C=C';
  writeln('AnsiCompareStr(''C-C'',''C=C'') = ',ansicomparestr(S1,S2));

C:\Users\Bart\LazarusProjecten\ConsoleProjecten>fpc test.pas
Free Pascal Compiler version 3.0.0 [2015/11/16] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling test.pas
Linking test.exe
16 lines compiled, 2.5 sec, 64048 bytes code, 4052 bytes data

AnsiCompareStr('C-C','C=C') = 1

(Same result with fpc 2.6.4)


More information about the fpc-pascal mailing list