🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
1 messages
1 total messages Started by Mark Guerrieri Thu, 24 Aug 2006 00:11
Variant/TVariant bug(?)
#3156
Author: Mark Guerrieri
Date: Thu, 24 Aug 2006 00:11
29 lines
1602 bytes
BDS 2006 All SP/HotFixes applied:

Can someone explain this to me please?


AnsiString s1 = "Test";
int len1 = s1.Length();  // len1 = 4
TVariant v1 = s1;
Variant v2 = v1;
AnsiString s2 = (AnsiString)v2;
int len2 = s2.Length(); // len2 = 5 ?!?!?!?


Am I missing something, or did BDS just try to pull a fast one on me?

Replaceing

AnsiString s2 = (AnsiString)v2;

with

WideString s2 = (WideString)v2;

produces the correct results (i.e. length is 4...)

There appears to be a problem converting a Variant of type VOleStr to an 
AnsiString.  Can anyone confirm this for me?

Mark
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads