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

jordanwb jordan.w.bradley at gmail.com
Mon Jun 30 16:00:02 EDT 2008


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 
-- 
View this message in context: http://www.nabble.com/DriveInfo%27s-TotalSize%2C-AvailableFreeSpace-and-TotalFreeSpace-reports-my-flash-drive%27s-size-as-8PB-tp18203189p18203189.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list