[Haskell-cafe] Re: Writing binary files?

Scott Turner p.turner at computer.org
Thu Sep 16 08:40:20 EDT 2004

On 2004 September 16 Thursday 06:19, Simon Marlow wrote:
> Argv and the environment - I don't know.  Windows CreateProcess() allows
> these to be UTF-16 strings, but I don't know what encoding/decoding
> happens between CreateProcess() and what the target process sees in its
> argv[] (can't be bothered to dig through MSDN right now). 

In Windows, CommandLineToArgvW provides a way to obtain a Unicode set of argv 
and argc values from a Unicode command-line string. Visual C++ supports 
defining a wmain function which is like main except it receives a Unicode 
argv. I looked for details of how the args are converted for an ordinary C 
'main' function, but didn't turn up much else while digging through MSDN. 
Windows distinguishes between the system code page and the C runtime locale 
(which is initially ASCII).

So Windows would work best if getArgs returns a String, while on Unix it would 
avoid encoding problems if it returns [Byte].

More information about the Haskell-Cafe mailing list