online 1
gast (50)

/ Forum / Anwendungen(Java,C++...)

Anwendungen(Java,C++...)Anwendungen(Java,C++...)

Fragevon cplsplsfragi vom 12.05.2022, 15:44 Options

c strings vs. Text strings

Hi,

das lässt sich so nicht kompiliren:

 if (strcmp(txt1->Text, "passwort") == 0)
	 MessageBox::Show("Good");
 else
	MessageBox::Show("Bad");


da:

Zitat:

Konvertierung des Parameters 1 von 'System::String ^' in 'const char *' nicht möglich


Ich vermute, das strcmp nur c strings akzeptirt, was wäre denn die beste möglichkeit, den textbox textstring in ein c-string umzuwandeln?

lg,
c++fragi


Antwort schreiben

Antwort 1 von compilierguru vom 12.05.2022, 17:09 Options

lass doch das altbackene hinter dir und benutze die passenden funktionen zu deinen klassen:

http://msdn.microsoft.com/de-de/library/system.string.compare%28VS....

Antwort 2 von cplsplsfragi vom 12.05.2022, 18:34 Options

Super idee!

 if ((txt1->Text->CompareTo("pass")) == 0)
	MessageBox::Show("Good");
 else
	MessageBox::Show("Bad");


danke ;)

Antwort 3 von cplsplsfragi vom 12.05.2022, 18:41 Options

trotzdem:#


if ((txt1->Text->Compare("pass", "pass")) == 0)
	MessageBox::Show("Good");
 else
	MessageBox::Show("Bad");


Wie komme ich zu ->Compare(x, x) OHNE dem textbox->text->
davor?


thx, :)

Ähnliche Themen

Eine bat datei online ausführen
gast57  07.11.2008 - 26 Hits - 9 Antworten

einer Zelle in Excel noch einen Text zu ordnen
PollerX  10.11.2008 - 34 Hits - 1 Antwort

Java Text-Datei einlesen mit LineNumberReader
Hallo156  24.04.2009 - 1385 Hits - 2 Antworten

VB6 Text einer MSBox eines anderen Programmes.
HerrFragtSich  06.10.2009 - 219 Hits - 1 Antwort

Hinweis

Diese Frage ist schon etwas älter, Sie können daher nicht mehr auf sie antworten. Sollte Ihre Frage noch nicht gelöst sein, stellen Sie einfach eine neue Frage im Forum..

Neue Einträge

Version: supportware 1.9.150 / 10.06.2022, Startzeit:Thu Jan 8 21:07:44 2026