Sorry for the off-topic post.  I figured someone here would know the answer
and I don't have access to Windows to check experimentally.

The ocrad program opens its input like so:

    if ( std::strcmp( infile_name, "-" ) == 0 )
        infile = stdin;
    else
        infile = std::fopen( infile_name, "r" );

(SpamBayes is starting to use ocrad and PIL to extract text from image
spam).  Ocrad fails on Windows because the input file is opened in text
mode.  That "r" should be "rb".  What's not clear to me is whether we can do
anything about stdin.  Will this work:

    if ( std::strcmp( infile_name, "-" ) == 0 )
        infile = std::fdopen( std::fileno(stdin), "rb" );
    else
        infile = std::fopen( infile_name, "rb" );

That is, can I change stdin from text to binary this way or is it destined
to always be in text mode?

Thx,

Skip
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to