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

Henk-Jan van Tuyl hjgtuyl at chello.nl
Sat Oct 8 21:34:30 CEST 2011


On Sat, 08 Oct 2011 18:45:43 +0200, Chaddaï Fouché  
<chaddai.fouche at gmail.com> wrote:

> 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.

You can use the information about createFile at:
   http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx

Regards,
Henk-Jan van Tuyl


-- 
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--



More information about the Beginners mailing list