[Haskell-beginners] Fwd: Real World Haskell: From Portable to System.Win32
Paulo M. Pocinho
pocinho at gmail.com
Sun Oct 9 03:24:11 CEST 2011
createFile is probably what I should be looking for. As a side note, I
really think this is not a big deal. The portable code is a lot
better. I wonder if that exercise was a pun on working with Haskell
code just to step back into foul territory. And yes, extra careful on
the parameters, or it may end up corrupting other files, launch the
missiles and whatnot. One thing I noticed so far using Haskell,
usually I have to spend more time thinking before hitting the
keyboard. Yet the code is always elegant.
Meanwhile, I've been taking a peek inside System.IO.HVFS from MissingH
[1]. Looks nice.
Thanks for the replies.
Cheers!
--
[1] http://hackage.haskell.org/packages/archive/MissingH/1.1.1.0/doc/html/System-IO-HVFS.html#v:vGetModificationTime
On 8 October 2011 20:34, Henk-Jan van Tuyl <hjgtuyl at chello.nl> wrote:
> 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