Problem interacting with the console

Jacob Carlborg doob at me.com
Sat Mar 31 08:32:11 PDT 2012


On 2012-03-29 21:51, Jacob Carlborg wrote:
> I'm trying to port a C application to D. The problem I have is
> interacting with the console. I'm using the POSIX "read" function, the
> problem is that in the D version the "read" function seems to never
> return. The C version works fine and prints "**********" after I press a
> key. I've created a small test case for the problem below:
>
> D code: http://pastebin.com/SsYZcjMG
> C code: http://pastebin.com/QyprKD17
>
> Is suspect that it's something in the "initterm" function that isn't
> working properly. Any ideas?
>
> I'm using DMD 2.058 on Mac OS X.

If anyone else is interested, I finally find the problem. Some types 
used by the termios struct was incorrectly declared resulting in the 
wrong size on 64bit.

I've created a pull request for this in druntime:

https://github.com/D-Programming-Language/druntime/pull/189

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list