aspell-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Aspell-user] Problem using aspell in -a mode


From: Joerg Toellner
Subject: [Aspell-user] Problem using aspell in -a mode
Date: Tue, 10 May 2005 11:48:21 +0200

Hi Group,

i'm new to aspell, so please excuse if this is a dumb question. Maybe
it's a little OT too, as it concerns a pure C++ question.

Using:
aspell 0.60 VC++ Windows Port
Windows ME
MSVC 6.0
wxWidgets Framework 2.6.0

I am writing a program in which i want to implement spellchecking
capabilities using aspells pipe interface (-a ispell compatibility
mode).

I compiled the a.m. version of aspell and started it via the
wxExecute-Function from wxWidgets, opening anonymous pipes redirecting
the stdin, stdout and stderr from aspell to capture the output from
aspell and write to aspell in/from my app.

I confirmed that aspell is running after starting. It is! I confirmed
that my and wx-code, especially opening the pipes and redirection, gives
me no error resultcodes. It doesn't!

Now i have the problem that somehow i never receive sth. from aspell on
the redirected aspell-stdout in my app. I expected to get the "<#@> This
is ispell ..." version information line as soon as i start aspell in -a
mode.

It can't be a problem of "not correctly opened/redirected pipe" for two
reasons. First, i use the same "start an external program and redirect
its in/outs"-mechanism (same code packed in a c++ class) for "talking"
to gocr (GNU Optical Character Recognition) too. And there all works
fine (after unbuffering the stdout from gocr).

And second, if i place a normal printf("Blah...") in the aspell code at
the beginning of the main() function, i receive this "Blah..." as
expected on my end of the pipe immediately after starting aspell. But i
neither get the version info line nor sth. else when i send a line for
spellcheck to aspell. But aspell is still running and it seems it is
waiting for input as expected.

If i start aspell in the console window manually with the same command i
use in my app, the "Blah..." line as well as the version info line shows
up.

I tried to change the code with a setvbuf(stdout, 0, _IONBF, 0) command,
but this have no effect. I tried to debug down to the version line
output and tried to figure out what aspell is doing with this COUT.put
but can't find anything special here why it won't work.

It seems that can be a buffered/unbuffered problem here, but i have no
idea what to do to change this in another way as using the setvbuf
command. 

Another info: When i get an error from aspell (e.g. a missing dictfile
or another misused configuration switch or whatsoever), i receive this
error message immediately from aspell via the stderr pipe (Another
reason for assuming that my redirection works).

Now i'm helpless. Why is the "normal" printf working, but the aspell
COUT.put not? Any one have an idea and can get me in the right
direction? What am i missing here or doing wrong. What to change in the
aspell code (in my code?) and where?

Of course i could use the static libs and the C-API of aspell. But as i
want to write a aspell-wrapper-class that all my programs can use a
central aspell installation without linking the whole aspell libs
together in every each program i'd prefer using the pipe interface if
possible.

I wonder how the console itself solve this annoying
"buffered/unbuffered" problem even with programs that use buffered
stdin/out/err? Any hint (good url, howto, tutorial) here?

Thank you in advance. Every hint is really appreciated. 
CU
Joerg Toellner





reply via email to

[Prev in Thread] Current Thread [Next in Thread]