Autor Beitrag
Spooky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Fedora Core 1, Win XP Prof Corp.
D6 Enterprise, D7 Enterprise
BeitragVerfasst: So 31.08.03 12:58 
moin ich hab mal ne dumme frage
ich kriegs irgendwie nicht hin
wenn ich nen integer wert mit zb. 2000 habe und ich moechte aber anstatt 2000 lieber 200 da stehen haben wie mache ich das?
ich moechte den ram in mb ermitteln also zb. 512 mb und nicht
512363 oder so

_________________
gruss
Spooky
Taurin
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 34

Win XP
D6 Personal
BeitragVerfasst: So 31.08.03 14:11 
2000 -> 200 : Du teilst durch 10 ???
von KB nach MB: Du teilst durch 1024 ???
kat1
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 40

Win XP
D6 EntPr
BeitragVerfasst: So 31.08.03 15:22 
Jo mit dem Unterschied, dass Du auf die Ergebnisvariable acht geben müsstest. Bei Verwendung von / als Divisionszeichen ist das ein Fließkommawert, willst Du dagegen immer noch einen integer-Wert haben, dann nimm div.

_________________
Mfg Uwe
Es ist eine Unsitte der Menschen, sich an alles zu gewöhnen.
Spooky Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Fedora Core 1, Win XP Prof Corp.
D6 Enterprise, D7 Enterprise
BeitragVerfasst: So 31.08.03 15:48 
also ich meine das ich immer NUR 3 stellen habe das das ergebnis bis auf 3 stellen gerundet wird
da giebts doch irgendwas mit len oder length
momentan hab ich so
ausblenden Quelltext
1:
GeTRAM := IntToStr(Memory.dwTotalPhys div 1024);					

und wenn ichs bei mir ausfuehre hab ich da stehen 523636
aber es sind 3 stellen zuviel

_________________
gruss
Spooky
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: So 31.08.03 16:14 
GlobalMemoryStatus liefert die Anzahl der Bytes zurück, du willst das ganze aber in MegaBytes haben...

1KB = 1024 Bytes
1MB = 1024 KBytes -> 1MB = 1024 * 1024 Bytes

Durch eine einmalige Division durch 1024 bekommst du das ganze als Kilobytes, und nicht als Megabytes! Da musst du nochmal dividieren!

BTW: du kannst eine Division durch 1024 auch durch ein shr 10 ersetzen.. bzw zur Umwandlung von Bytes in MB einfach shr 20 (zweifache Division)
ausblenden Delphi-Quelltext
1:
GetRAM := IntToStr(Memory.dwTotalPhys shr 20);					

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
Spooky Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 37

Fedora Core 1, Win XP Prof Corp.
D6 Enterprise, D7 Enterprise
BeitragVerfasst: So 31.08.03 16:42 
jo danke klappt alles ;)

_________________
gruss
Spooky