Revision history for CppStringStreams


Revision [5614]

Last edited on 2008-10-20 21:28:33 by MatthiasT
Additions:
=====stringstreams=====
Mit atoi(), atol() und atof() können strings in integer, long bzw. double Werte konvertiert werden, aber wie siehts umgekehrt aus?
Die Lösung erfolgt komfortabel über stringstreams.
Das nachfolgende Programm demonstriert den Einsatz.
%%(cpp)
#include <iostream>
#include <string>
#include <sstream> // benötigte Bibliothek
int main()
{
int ZAHL;
std::string ZEICHENKETTE;
ZAHL = 5;
std::stringstream ss; // Kernstück
ss << ZAHL;
ss >> ZEICHENKETTE;
std::cout << ZEICHENKETTE;
return 0;
}
%%
Ausgabe:
%%
5
%%
Deletions:
=====Titel=====


Revision [5613]

The oldest known version of this page was created on 2008-10-20 21:19:35 by MatthiasT
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki