[#3726] Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...>

Hi --

15 messages 2004/11/12
[#3749] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3751] Re: Fixnum#clone and Float#clone raise different exceptions — Yukihiro Matsumoto <matz@...> 2004/11/16

Hi,

[#3752] Re: Fixnum#clone and Float#clone raise different exceptions — "David A. Black" <dblack@...> 2004/11/16

Hi --

[#3785] The latest 1.8.2 cvs prints parse error when starting extension compiling — Yukihiro Matsumoto <matz@...>

Hi,

13 messages 2004/11/23
[#3787] Re: The latest 1.8.2 cvs prints parse error when starting extension compiling — Johan Holmberg <holmberg@...> 2004/11/23

File::Stat#blksize for Win32

From: Daniel Berger <djberg96@...>
Date: 2004-11-27 04:06:46 UTC
List: ruby-core #3831
Hi all,

Can we add support for File::Stat#blksize for Win32? 
Below is a simple script that demonstrates how to get
it.

Note that, although GetDiskFreeSpace() isn't reliable
for getting disk sizes over 2 GB, it is still reliable
for getting block size.

The only modification you might need is to attempt to
get the root path of the file name, rather than
resorting to NULL.

Regards,

Dan

#include <windows.h>
#include <stdio.h>

int main(){
   DWORD dwSectorsPerCluster, dwBytesPerSector;
   DWORD dwNumberOfFreeClusters,
dwTotalNumberOfClusters;
   int rv, blksize;
   
   rv = GetDiskFreeSpace(
      NULL, // or determine root path dynamically
      &dwSectorsPerCluster,
      &dwBytesPerSector,
      &dwNumberOfFreeClusters,
      &dwTotalNumberOfClusters
   );

   if(0 == rv){
      // Raise an error?  Return nil?
   }

   blksize = dwBytesPerSector * dwSectorsPerCluster;
   printf("blksize: %i\n",blksize);
   return 0;
}

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

In This Thread

Prev Next