[Gtk-sharp-list] DriveInfo's TotalSize, AvailableFreeSpace and TotalFreeSpace reports my flash drive's size as 8PB

Chris Howie cdhowie at gmail.com
Fri Jul 11 09:38:09 EDT 2008


On Mon, Jun 30, 2008 at 4:00 PM, jordanwb <jordan.w.bradley at gmail.com> wrote:
> Ok I did do a search and found three topics talking about the same thing. I
> started reading and I didn't know what the heck I was reading.
>
> Using the following code:
>
> using System;
> using System.IO;
>
> namespace ConsoleProject1
> {
>        class MainClass
>        {
>                public static void Main(string[] args)
>                {
>                        DriveInfo[] drives = DriveInfo.GetDrives ();
>
>                        foreach (DriveInfo drive in drives)
>                        {
>                                if (drive.ToString ().Equals ("/media/disk"))
>                                {
>                                        Console.WriteLine (drive.TotalSize);
>                                        Console.WriteLine (drive.AvailableFreeSpace);
>                                        Console.WriteLine (drive.TotalFreeSpace);
>                                        Console.WriteLine (drive.DriveFormat);
>                                }
>                        }
>                }
>        }
> }
>
> The following is outputted:
>
> here System.IO.StreamReader
> L: Linux
> 9223372036854775807
> 9223372036854775807
> 9223372036854775807
> vfat
>
> I changed the 922whatever into the smallest value and it came out 8
> Petabytes. I'm running version 1.9.1 of Mono on Ubuntu 8.04

IIRC, the DriveInfo class has not been completely implemented yet.

(And BTW this is off-topic for this mailing list.  I think you wanted
the main Mono list.)

-- 
Chris Howie
http://www.chrishowie.com
http://en.wikipedia.org/wiki/User:Crazycomputers


More information about the Gtk-sharp-list mailing list