Hallo
Sicherlich haben sich viele schon gefragt, wie man
eine Eingabe mit Abfrage programmiert
Ich schreibe gerde an einer kleinen Konsole mit eingabefunction.
das ganze laüft auch so weit
aber das Problem dabei ist dass ich nur 1 String abfragen kann:
es tuts nur wenn ich testb eingebe
Frage: WARUM nur ein string und wie bekomme ich nach eingabe
den String (input) wieder sauber ??
str_cpy(input,"") lässt die Input nur blinken ...
hier der Code: ->
ich hoffe er gefällt euch :-)
STRING* input = "#80";
STRING* text_a = "testa";
STRING* text_b = "testb";
//////////////////////////////////////
TEXT* def_ctxt =
{
string("",input);
layer = 999;
}
///////////////////////////
TEXT* show_txt =
{
pos_x = 100;
pos_y = 100;
flags = SHOW;
layer = 999;
}
///////////////////////////
void console()
{
toggle(def_ctxt,SHOW);
while is(def_ctxt,SHOW)
{
inkey((def_ctxt->pstring)[1]); // write ...
//input a //
if (str_cmp(input,text_a))
{
(show_txt.pstring)[0] = "Input A Okey";
}
//input b //
if (str_cmp(input,text_b))
{
(show_txt.pstring)[0] = "Input B Okey";
}
else
{
(show_txt.pstring)[0] = "Error";
}
}
}
function main()
{
console(); // start console
}