Forum: PC-Programmierung serialPort1->SelectedItem in eine Textdatei


von Seprendium Diagnostica (Gast)


Lesenswert?

Hallo

Ich programmiere mit VC++ .net.

ich habe ein kleines Problem mit speichern der Baudrate des SerialPorts 
in eine textdatei.

Bis jetzt habe ich:
1
FILE* txtfile; 
2
3
txtfile = fopen("bin\\log.txt","w"); 
4
fprintf(txtfile, "%s", comboBox1->Items);
5
fclose(txtfile);

in der Combobox sind die Baudraten aufgelistet.

Aber das programm speichert nicht das Item in der Textbox. Wenn ich 
statt:
1
fprintf(txtfile, "%s", comboBox1->Items);
2
3
fprintf(txtfile, "%s", "hallo");

schreibe, speichert er logischerweise das Hallo in die textdatei.
Warum speichert er nicht die baudrate in die datei?

Ich hoffe ihr könnt mir helfen,

Seprendium Diagnostica

von Franko P. (sgssn)


Lesenswert?

Hallo

ich arbeite mit dem Borland C++-Builder, da würde das so heissen:

fprintf(txtfile, "%s", comboBox1->Items->Strings[0]);

Gerhard

von fubu1000 (Gast)


Lesenswert?

Hallo,
ich würds so machen!

System::IO::File::WriteAllText(C:\\t1.txt , 
comboBox1->Items->ToString());

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.