TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BRYAN JOYCE
from: ROBERT LA FERTE
date: 1998-02-02 03:33:00
subject: Builder C++

BJ>         struct Table
BJ>         {
BJ>            char Title[30];
BJ>            char SubTitle[35];
BJ>            char Info1[40];
BJ>            char Info2[40];
BJ>         };
BJ> 
BJ> Then.....
BJ> 
BJ>         Table.Title=Edit1->Text;      (this line does not work  )
BJ>                                       (neither does using strcpy)
BJ> 
BJ> I know that the editbox contains an ANSI string, but don't know how to
BJ> convert it to my table structure chars.
I don't have it on this machine, but if I remember well:
        strncpy(Table.Title, Edit1->Text.c_str(), sizeof(Table.Title));
should work quite well...  don't forget that the 'Text' member of Edit1
is a 'AnsiString' class, thus requires a conversion to be used like a
'normal' C null-terminated char array.
Bob
--- Maximus/2 3.01
---------------
* Origin: COMM Port OS/2 juge.com 204.89.247.1 (281) 980-9671 (1:106/2000)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.