Was ist der richtige Weg, unsigned int
in double
zu konvertieren? Ich brauche das ist für QCPCustomPlot
für die Dateneinstellung, wie es in QVector<double>
genau als Parameter zum Erstellen eines Graphen dauert.C++ unsigned int zur Doppelkonvertierung
EDIT: Silly mich. Das 'Speicherverlust'-Fehlerproblem wurde verursacht, weil ich falsch initialisiert habe. Der Wert time
wurde auf den gleichen Wert wie ipv4int
(Häufigkeit des Datenvorkommens) und x
und y
korrekt geändert.
Fertig mit der time
Variable, jetzt das eigentliche Problem in Bezug auf die Konvertierung. Wie kann ich es in double
Format konvertieren, das Wert wie 1855919686
statt im Format 1.85592e+09
enthält?
QCustomPlot erfordert double
aber es scheint, dass die QVector<double>
nicht in Wert wie 1.85592e nehmen könnte + 09
Aktualisiert Code:
QVector<double> x(i), y(totalIP); //i=236052
for(int o = 0; o <= i; o++){
double dSec = arrayIPxTime[o][0] - startSecond; //arrayIPTime[o][0] holds time in second
double dMin = dSec/60;
double ipv4addr = arrayIPxTime[o][1]; //arrayIPTime[o][0] holds ipaddr in integer format
x[o] = dMin;
//y[o] = ipv4addr; this is the line that causes crash.
qDebug()<<"Count "<<o<<" time "<< x[o] <<" ipv4 "<<ipv4addr<<" arrayIPxTime[o][1] "<<arrayIPxTime[o][1];
}
Stromausgang:
Count 236048 time 62.3167 ipv4 1.85592e+09 arrayIPxTime[o][1] 1855919686
Count 236049 time 62.3167 ipv4 1.85592e+09 arrayIPxTime[o][1] 1855919686
Count 236050 time 62.3167 ipv4 1.85592e+09 arrayIPxTime[o][1] 1855919686
Count 236051 time 62.3167 ipv4 1.85592e+09 arrayIPxTime[o][1] 1855919686
_ "Konvertieren von unsigned int-Variablen in doppelt verursachten Speicherlecks" _ Wie sind Sie darauf aufmerksam geworden? Das ist normalerweise nicht der Fall. –
Sie _need_, um mehr Details über das, was passiert, zu geben. Eine einfache Konvertierung selbst verursacht keinen Speicherverlust. Es ist ein völlig anderes Anliegen. –