PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : QTextIStream - warum?



sutterp
12-11-2001, 10:32
Hallo allerseits,

ich bin noch etwas unerfahren in c++, kenne aber 'antike' sprachen wie pascal und fortran relativ gut.

wer hilft mir mit meinem problem?

ich brauche eine umwandlungsroutine welche eine zeit die in QString format vorliegt in ein Qtime umwandelt. Dazu moechte ich QTextIStream benuetzen:

z.b.

QString MyTime;
int HH;
int MM;
int SS;

MyTime = "06 15 30";
QTextIStream (&MyTime) >> HH >> MM >> SS;
cout << "Started with " << MyTime << " hh = " << HH << " mm = " << MM << " ss = " << SS << endl;

MyTime = "07 15 30";
QTextIStream (&MyTime) >> HH >> MM >> SS;
cout << "Started with " << MyTime << " hh = " << HH << " mm = " << MM << " ss = " << SS << endl;

MyTime = "08 15 30";
QTextIStream (&MyTime) >> HH >> MM >> SS;
cout << "Started with " << MyTime << " hh = " << HH << " mm = " << MM << " ss = " << SS << endl;

MyTime = "09 15 30";
QTextIStream (&MyTime) >> HH >> MM >> SS;
cout << "Started with " << MyTime << " hh = " << HH << " mm = " << MM << " ss = " << SS << endl;

MyTime = "10 15 30";
QTextIStream (&MyTime) >> HH >> MM >> SS;
cout << "Started with " << MyTime << " hh = " << HH << " mm = " << MM << " ss = " << SS << endl;

Der output von diesem code ist:

Started with 06 15 30 hh = 6 mm = 15 ss = 30
Started with 07 15 30 hh = 7 mm = 15 ss = 30
Started with 08 15 30 hh = 0 mm = 8 ss = 15
Started with 09 15 30 hh = 0 mm = 9 ss = 15
Started with 10 15 30 hh = 10 mm = 15 ss = 30

Frage: Was ist so speziell and den zeiten zwischen 08:00 und 09:59? Warum gehen die stunden fuer diese zeiten in den zweiten int?

Umgebung: Suse Linux V7.1, KDevelop V1.3, 1000 Mhz Pentium IV.

Vielen dank fuer eure hilfe.

Peter