Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-12

longint -> Pchar

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Darren Reynolds

Is there a (hopefully easy) way to convert a longint variable to either Pchar / string / ansistring without changing the contents of the variable? For example, longint variable containing "12345" converted to one of the string types would still print as "12345". Closest I've been able to get so far results in the converted variable being printed as some strange characters ...

Reply by email

Marco van de Voort
to Darren Reynolds
Show quoted text 6 lines
Is there a (hopefully easy) way to convert a longint variable to either Pchar / string / ansistring without changing the contents of the variable? For example, longint variable containing "12345" converted to one of the string types would still print as "12345". Closest I've been able to get so far results in the converted variable being printed as some strange characters ...

You always need a conversion. Either str() (in system) or sysutils.inttostr.

The memory layout of a string and longint is not the same.

Reply by email

baron kractor
to Marco van de Voort

Got that particular issue fixed. Now I'm having some issues w/ really strange query results being returned. Even with the example code that came w/ the version of fpc that I'm using, I get the following results from a query that should return 0 or nil ...

Number of records returned : 8589934592
Number of fields per record : 0

Talked to some people, and it was suggested that perhaps the version of libmysql.dll I'm using doesn't match the version of mysql that the program is accessing. The machine that's hosting the mysqld is running openbsd 3.4, and the output of "mysql --version" results in the following ...

mysql Ver 11.18 Distrib 3.23.57, for unknown-openbsd3.4 (i386)

Anyone else had this problem before?

Earlier message 20 lines
-----Original Message----- From: On Behalf Of Marco van de Voort Sent: December 10, 2003 5:43 AM To: Subject: Re: [fpc-pascal]longint -> Pchar > Is there a (hopefully easy) way to convert a longint variable to either > Pchar / string / ansistring without changing the contents of the variable? > For example, longint variable containing "12345" converted to one of the > string types would still print as "12345". Closest I've been able to get so > far results in the converted variable being printed as some strange > characters ... You always need a conversion. Either str() (in system) or sysutils.inttostr. The memory layout of a string and longint is not the same.

Reply by email

baron kractor
to baron kractor

On a hunch I grabbed an older version of the win32 mysqld "non installer" (zip file) and started using *that* version of libmysql.dll

Everything seems to be working ok now ... sorry for the previous post, hopefully I haven't annoyed anyone too much.

Earlier message 44 lines
-----Original Message----- From: On Behalf Of baron kractor Sent: December 10, 2003 4:29 PM To: Subject: RE: [fpc-pascal]longint -> Pchar Got that particular issue fixed. Now I'm having some issues w/ really strange query results being returned. Even with the example code that came w/ the version of fpc that I'm using, I get the following results from a query that should return 0 or nil ... Number of records returned : 8589934592 Number of fields per record : 0 Talked to some people, and it was suggested that perhaps the version of libmysql.dll I'm using doesn't match the version of mysql that the program is accessing. The machine that's hosting the mysqld is running openbsd 3.4, and the output of "mysql --version" results in the following ... mysql Ver 11.18 Distrib 3.23.57, for unknown-openbsd3.4 (i386) Anyone else had this problem before? -----Original Message----- From: On Behalf Of Marco van de Voort Sent: December 10, 2003 5:43 AM To: Subject: Re: [fpc-pascal]longint -> Pchar > Is there a (hopefully easy) way to convert a longint variable to either > Pchar / string / ansistring without changing the contents of the variable? > For example, longint variable containing "12345" converted to one of the > string types would still print as "12345". Closest I've been able to get so > far results in the converted variable being printed as some strange > characters ... You always need a conversion. Either str() (in system) or sysutils.inttostr. The memory layout of a string and longint is not the same.

Reply by email