/ Forside / Teknologi / Udvikling / C/C++ / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
C/C++
#NavnPoint
BertelBra.. 2425
pmbruun 695
Master_of.. 501
jdjespers.. 500
kyllekylle 500
Bech_bb 500
scootergr.. 300
gibson 300
molokyle 287
10  strarup 270
(win, BCB) Convertere AnsiString til Char
Fra : Martin Schultz


Dato : 28-11-00 17:02

Hvordan konvertere man en AnsiString til en char?

Jeg bruger borland C++ Builder 3(på win)

 
 
N/A (28-11-2000)
Kommentar
Fra : N/A


Dato : 28-11-00 20:13



N/A (28-11-2000)
Kommentar
Fra : N/A


Dato : 28-11-00 20:13



Jens Stål (28-11-2000)
Kommentar
Fra : Jens Stål


Dato : 28-11-00 20:13

"Returns the AnsiString converted to null-terminated character array.

char* __fastcall c_str() const;

Description

c_str returns a pointer a null-terminated character array containing the
same characters as the AnsiString. If the AnsiString is unassigned, c_str
returns an empty string ("").

Usually, the value returned by c_str points to the internal character array
referenced by the data property. This pointer is valid until the string is
next modified (for example when the SetLength method is called or the
AnsiString goes out of scope). However, if the internal array is NULL, c_str
returns a pointer to a string literal.

The c_str method is intended primarily for reading the value of the
AnsiString. To modify the string's value, use the [] operator or AnsiString
methods such as Insert and Delete." - Citat slut

"Igor V. Rafienko" <igorr@ifi.uio.no> wrote in message
news:xjvlmu4lyi2.fsf@fimm.ifi.uio.no...
> * Jens Stål
> > I BCB 5 gør man som følger
> >
> > AnsiString tmpString = "Hello World";
> > char* tmpChar = tmpString.c_str();
>
>
> Er BCB5 _så_ dum at c_str() ikke returnerer en const char*? Og i
> motsatt fall, hvorfor er ikke tmpChar en const char*?
>
>
>
>
>
> ivr
> --
> Partial Nudity is allowed by female users.



Martin Schultz (28-11-2000)
Kommentar
Fra : Martin Schultz


Dato : 28-11-00 21:31

On Tue, 28 Nov 2000 19:05:01 +0100, "Jens Stål" <Jens@cue.dk> wrote:

>I BCB 5 gør man som følger
>
>AnsiString tmpString = "Hello World";
>char* tmpChar = tmpString.c_str();

Tak


Søg
Reklame
Statistik
Spørgsmål : 177501
Tips : 31968
Nyheder : 719565
Indlæg : 6408526
Brugere : 218887

Månedens bedste
Årets bedste
Sidste års bedste