Von printf nach cout...
-
Ich möchte folgendes mit cout ausgeben:
sprintf(szBuffer, "Kapazitaet: %5.1f GB ", (float) iBytes / 1024);Bitte um Hilfe
-
Sowas ist mit den streams etwas unhandlich, am besten wäre es boost::format zu verwenden, ansonsten schau dir mal ios_base::precision und ios_base::fill an.
btw. Bytes / 1024 ergibt KBytes nicht GBytes
-
Any schrieb:
btw. Bytes / 1024 ergibt KBytes nicht GBytes
wenn schon dann millibytes

kernel: nimm doch einfach printf() wenn's einfacher ist
-
geht so:
cout << "Kapazitaet: " << fixed << setprecision( 1 ) << setw( 5 ) << float( iBytes ) / 1024 << " GB " << endl;braucht
#include <iostream> #include <iomanip>Gruß
Werner
-
net schrieb:
wenn schon dann millibytes

Etwas zu tief ins Glas geschaut? :p
-
Da hat wohl wer in die falsche Richtung gedacht
