[Kde-bindings] Qyoto: Reading from stdin from a gui-application

Arno Rehn arno at arnorehn.de
Sun May 18 19:59:24 UTC 2008


Am Sonntag 18 Mai 2008 20:21:47 schrieb Christoph Spielmann:
> [...]
> Here everything works except reading from stdin (means
> this.stdin.ReadLine(buf,(long)255);). When i try to replace ReadLine
> with ReadAll the UI becomes unresponsive and that should not happen in
> my application.
Ah, now I see what's the problem. As I've already explained, the code is not 
correctly generated since the string is passed as a reference and modified in 
C++. In C# this has to be an 'out' parameter. I'll look into this in the next 
week.
To work round this you can simply use QIODevice.ReadLine(). It doesn't use a 
buffer and simply reads till the end of the line. This works fine on my 
setup:
        [Q_SLOT]
        public void DataReadyOnStdin() {
            Console.WriteLine(this.stdin.ReadLine().ConstData());
        }


> Some more info on my setup:
>
> I'm on Gentoo/AMD64 (i can almost here the oh-noes here ;) ) here, with
> QT 4.3.4 (qt-4.4 has not hit portage yet) and kde-4.0.4 with manually
> compiled kdebindings (another thing that's not in the tree, quite a
> shame in my eyes but okey i can help myself ;) )
Oh, actually I'm on Gentoo ~amd64, too. There's qt-4.4.0_rc1 in portage and 
that works quite well. :)

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list