[gs-devel] Problems with stdin and return code -110

Ken Sharp ken.sharp at artifex.com
Thu Feb 5 08:37:53 PST 2009


Hi Sheri,

At 11:08 05/02/2009 -0500, Sheri Steeves wrote:


>When reading from the stdin, while the output file is created, I am 
>getting a return code of -101, which is "Ghostscript failed to open the file."

I don't doubt you, but where did you find this ? Error -101 seems to be the 
e_Quit error, which means the quit operator was executed. Quite likely 
because that happens for any error. It also happens (if I remember 
correctly) if you just reach the end of input, eg your ps_stdin returned 0 
bytes.


>I am using a PS file, the docs say this shouldn't work for a PDF.

PDF files require random access to the file so no, you can't do PDF files 
that way.


>I do not fall into any error cased from my stdin callback. I am passing 
>"-_" to my gsarv and opening my file with:
>
>_topen( (LPCTSTR) szFile, _O_BINARY, _S_IREAD ) ;
>
>Am I missing a command line argument or something? Any help is appreciated!

Did you follow into topen to see what actually gets executed ? If _UNICODE 
is defined (for your app) then this should use _wopen, otherwise it should 
use _open.

You did check the returned file handle for validity ? (I know, but I have 
to ask...)


>My stdin callback is declared as follows, extra error checking removed
>int GSDLLCALL pn_stdin( void *caller_handle, char *buf, int len) {
>     int nRead, fh = 0 ;
>
>     fh = pJobProcessor->GetGSConverter()->GetFileHandle();
>
>     nRead = _read( fh, buf, len ) ;
>     return nRead ;
>}

Again, you did check your stdin routine was executed, that _read returned 
some bytes, and that nRead was non-zero ?

I can't see anything immediately wrong. Its getting late for me I'm afraid, 
if nobody else helps you out before then I'll try building a skeleton 
tomorrow and see what I can find.



                     Ken



More information about the gs-devel mailing list