Re: [Haskell-cafe] Regarding Haskell FFI for C/C++ (Passing of String)

2012-03-27 Thread rajendra prasad
Thanks Yves for the reply. The link provided by you is very helpful. Thank you very much. Regards, Rajendra On Thu, Mar 22, 2012 at 7:53 PM, Yves Parès yves.pa...@gmail.com wrote: (Sorry for the double post) Forget about ByteString.Char8: it doesn't handle unicode as it truncates

[Haskell-cafe] Regarding Haskell FFI for C/C++ (Passing of String)

2012-03-22 Thread rajendra prasad
Hi, I have just started learning Haskell FFI. I am trying to send a string from hastell to a C function. For this, I am required to convert the haskell string to byte string. I have two methods to achieve this task. Both are listed below: 1) import Foreign.C.String let arg1 = map

Re: [Haskell-cafe] Regarding Haskell FFI for C/C++ (Passing of String)

2012-03-22 Thread Yves Parès
This joins the question I asked two days ago here. (See http://haskell.1045720.n5.nabble.com/Quickest-way-to-pass-Text-to-C-code-td5582223.html ) Hope that helps. Le 22 mars 2012 15:10, rajendra prasad rajendradpra...@gmail.com a écrit : Hi, I have just started learning Haskell FFI. I am

Re: [Haskell-cafe] Regarding Haskell FFI for C/C++ (Passing of String)

2012-03-22 Thread Yves Parès
(Sorry for the double post) Forget about ByteString.Char8: it doesn't handle unicode as it truncates characters. Going from String to bytestring is easy thanks to the utf8-string ( http://hackage.haskell.org/packages/archive/utf8-string/0.3.7/doc/html/Codec-Binary-UTF8-String.html) package and