Article View: borland.public.cppbuilder.nativeapi
Article #9944Re: GetDiskFreeSpaceEx question
From: Ed Mulroy [TeamB]
Date: Tue, 01 Jun 2004 01:57
Date: Tue, 01 Jun 2004 01:57
27 lines
1815 bytes
1815 bytes
Disk manufacturers like using 10^9 for a gig instead of 2^30 because
they can then claim bigger numbers.
Try using
sprintf(a, "%0.2f", fbatc.QuadPart / 1.0E9);
Since you are already using AnsiString for the path variable, consider
using one for the output. Look at the AnsiString FormatFloat and
printf functions.
. Ed
> Martin C wrote in message
> news:40bbd229@newsgroups.borland.com...
>
> I am using the code below to retrieve the free diskspace
> of my hard drive, but I really don't know how to format
> the output to something like for example 55.57 GB.
>
> ULARGE_INTEGER fbatc, tnob, tnofb;
> ::GetDiskFreeSpaceEx(Path.c_str(), &fbatc, &tnob, &tnofb );
> char a[40] = { 0 };
> sprintf(a, "%I64Ld", (fbatc.QuadPart/1024)/1024);
> ShowMessage(a);
>
> Any help will be appreciated.
Technical Details
Message-ID:
<40bbe277@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<40bbd229@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,782d9cc15321c56a X-Google-Attributes: gid10cc67,public From: "Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> Newsgroups: borland.public.cppbuilder.nativeapi References: <40bbd229@newsgroups.borland.com> Subject: Re: GetDiskFreeSpaceEx question Date: Mon, 31 May 2004 21:57:06 -0400 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 12.161.27.52 Message-ID: <40bbe277@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1086055031 12.161.27.52 (31 May 2004 18:57:11 -0700) X-Authenticated-User: edmulroy Path: arc1-ca.pugleaf.net!controlnews3.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.icl.net!news.maxwell.syr.edu!newsfeed.frii.net!newsfeed.frii.net!news.compaq.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail