[Haskell-beginners] Real World Haskell: From Portable to System.Win32

Chaddaï Fouché chaddai.fouche at gmail.com
Sat Oct 8 18:45:43 CEST 2011


On Sat, Oct 8, 2011 at 7:47 AM, Paulo Pocinho <pocinho at gmail.com> wrote:
>
> getFileTime :: HANDLE -> IO (FILETIME, FILETIME, FILETIME)
>
> I suppose that means getFileTime takes a file handle (with type
> HANDLE) and returns an IO type with CreationTime LastAccessTime
> LastWriteTime [3].
>
> The thing is I don't know how to get a HANDLE type. I understand I can
> get a file handle by opening it. I've been trying the following:
>
> openFile :: FilePath -> IOMode -> IO Handle
> fh <- openFile "myfile.hs" ReadMode
>

Yes, the case is significant and that means that Handle and HANDLE
aren't the same, apparently HANDLE is specific to the win32 api (which
I don't know well), a rapid inspection of System.Win32.File seems to
reveal that the only function to get an HANDLE is createFile which has
a ton of parameters you'll need to set carefully to avoid overwriting
your existing file (you should probably define another function with
most of these already fixed for convenience) but should do the trick.

Good luck.
-- 
Jedaï



More information about the Beginners mailing list