AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

String in PAnsiString

Ein Thema von wo0zy · begonnen am 15. Apr 2003 · letzter Beitrag vom 16. Apr 2003
Antwort Antwort
Benutzerbild von wo0zy
wo0zy

Registriert seit: 14. Apr 2003
Ort: 127.0.0.1
80 Beiträge
 
Delphi 7 Enterprise
 
#1

String in PAnsiString

  Alt 15. Apr 2003, 12:54
hi gibts eine möglichkeit einen string in einen PAnsiString umzuwandeln ohne jedoch informationen zu verlieren??
It's not a bug it's a feature!
  Mit Zitat antworten Zitat
Benutzerbild von APP
APP

Registriert seit: 24. Feb 2003
Ort: Graz (A)
705 Beiträge
 
Delphi 7 Enterprise
 
#2
  Alt 15. Apr 2003, 15:35
Hallo,

bitte definiere
Zitat:
informationen zu verlieren
genauer
Armin P. Pressler

BEGIN
...real programmers are using C/C++ - smart developers Delphi;
END;
  Mit Zitat antworten Zitat
jbg

Registriert seit: 12. Jun 2002
3.481 Beiträge
 
Delphi 10.1 Berlin Professional
 
#3
  Alt 15. Apr 2003, 15:43
In den aktuellen Delphi Versionen ist string als AnsiString deklariert. Somit geht kann man einen string mit folgendem Code in einen PAnsiString (=PString) umwandeln.
Delphi-Quellcode:
var
  p: PAnsiString;
  s: string; // = AnsiString
begin
  p := @s;
end;
  Mit Zitat antworten Zitat
Benutzerbild von wo0zy
wo0zy

Registriert seit: 14. Apr 2003
Ort: 127.0.0.1
80 Beiträge
 
Delphi 7 Enterprise
 
#4

Sorry....

  Alt 15. Apr 2003, 15:56
sorry, aber ich hab mich verschrieben, ich meinte PAnsiChar.
It's not a bug it's a feature!
  Mit Zitat antworten Zitat
Benutzerbild von APP
APP

Registriert seit: 24. Feb 2003
Ort: Graz (A)
705 Beiträge
 
Delphi 7 Enterprise
 
#5
  Alt 15. Apr 2003, 16:29
Hallo,
meinst Du so etwas?
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  p: PAnsiChar;
  s: string;
begin
  s := 'test';
  p := pchar(s);
  showmessage(string(p));
end;
Armin P. Pressler

BEGIN
...real programmers are using C/C++ - smart developers Delphi;
END;
  Mit Zitat antworten Zitat
Benutzerbild von wo0zy
wo0zy

Registriert seit: 14. Apr 2003
Ort: 127.0.0.1
80 Beiträge
 
Delphi 7 Enterprise
 
#6
  Alt 16. Apr 2003, 15:42
ja, genau das hat mir gefehlt dankesehr!!
It's not a bug it's a feature!
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 09:26 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz