Posts

Showing posts with the label PwideChar

E2251 Ambiguous overloaded call to '%s' Delphi error

While porting our legacy project from old Delphi version to new Delphi version like from Delphi 7 to Delphi XE5, we faced above error frequently as we have used StrPas / StrPos / StrLen / TextToFloat function calls. And we found several cases and several reasons for cause of this error. Here I will explain why we get this error and what is the solution of this error. Some of following error we faced. E2251 Ambiguous overloaded call to 'Pos' E2251 Ambiguous overloaded call to 'StrPas' E2251 Ambiguous overloaded call to 'StrLen' E2251 Ambiguous overloaded call to 'TextToFloat' Why we get this error and what is the solution? Following are possible reasons of occurring this error in latest Delphi versions code. Case 1 If more than one overloaded version of a function exists in a unit and we are passing wrong arguments to the function call then this error will show. For example. We have different versions of StrPas function in  SysUtils.pa...

STRING / PCHAR / CHAR in Delphi

STRING / PCHAR / CHAR in Delphi --------------------------------------------- Char ------- Char is a data type that holds only one character as value. Ansi Characters are used to store single byte ansi characters. Unicode characters are used to store 2byte characters that is to cupport foreign languages like chinese, japanese etc. var    chr1 : Char;        // Holds a single character, alphabet    chr2 : WideChar;    // Holds a single character, International alphabet // for Unicode support    chr3 : AnsiChar;    // Holds a single character, alphabet NON-PRINTING OR CONTROL CHARACTERS, NOT USED IN THIS CLASS, INCLUDED FOR INTEREST ONLY   0 Null (nothing)  7 Bell  8 Back space  9 Tab 10 Line feed (new line at present column) 13 Carriage return (return to beginning of line) 26 End of file 27 [Esc] (Escape key) ASCII CHARACTER CODES 32 [space]   64 @ ...