简体   繁体   English

在Haskell中获取Windows版本号

[英]Get windows build number in Haskell

How can I get windows build number in Haskell? 如何在Haskell中获取Windows版本号? I think I can use readProcess and ver , but maybe there are more clear methods. 我想我可以使用readProcessver ,但是也许有更清晰的方法。

Is there a native C function in WinAPI that returns Windows build number? WinAPI中是否有本机C函数返回Windows内部版本号?

If yes, you can easily call it from Haskell using ForeignFunctionInterface extension. 如果是,则可以使用ForeignFunctionInterface扩展从Haskell轻松调用它。

The Win32 package seems to allow to access the build number, within the IO monad. Win32软件包似乎允许在IO monad中访问内部版本号。 Untested. 未经测试。

import System.Win32.Info.Version -- from Win32 package

main :: IO ()
main = do
   osVersionInfo <- getVersionEx
   print (dwBuildNumber osVersionInfo)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM