AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Programmieren allgemein REG_DWORD Dezimalzahl in "Datei größe" Formatieren
Thema durchsuchen
Ansicht
Themen-Optionen

REG_DWORD Dezimalzahl in "Datei größe" Formatieren

Ein Thema von Metal_Snake2 · begonnen am 25. Feb 2008
Antwort Antwort
Metal_Snake2

Registriert seit: 19. Nov 2004
134 Beiträge
 
Delphi 7 Personal
 
#1

REG_DWORD Dezimalzahl in "Datei größe" Formatieren

  Alt 25. Feb 2008, 19:50
hi,

ich habe z.B. einen schlüssel x mit dem DateiTyp "Reg_DWord".
X soll nun z.B. den Dezimalwert 6676940 haben.

Wie komme ich auf die rechnung das dieser wert 2424,45 MB ist?

Ich meine mit funktionen wie :

Delphi-Quellcode:
function TUtils.FormatFileSize(aSize: INT64): string;
const
  MB = Int64(1024 * 1024);
  GB = Int64(1024 * MB);
  TB = Int64(1024 * GB);
  PB = Int64(1024 * TB);
  cSize : array [0..5] of Int64 = (1, 1024, MB, GB, TB, PB);
  cLabel : array [0..5] of string = ('B', 'KB', 'MB', 'GB', 'TB', 'PB');
var
  lIndex : Integer;
begin
  lIndex := Ord(aSize >= cSize[1]) + Ord(aSize >= cSize[2]) + Ord(aSize >= cSize[3]) + Ord(aSize >= cSize[4]) + Ord(aSize >= cSize[5]);
  Result := Format('%g %s', [Int(100.0 * aSize / cSize[lIndex]) / 100, cLabel[lIndex]]);
end;
komme ich nicht weiter, kann mir einer helfen???
Meine vermuting ist das ich die Dezimalzahl irgendwie mit "Format" zurecht formatieren soll...jedoch habe ich bis jetzt nicht
richtig die Formatierung verstanden.


Danke fürs lesen.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:32 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz