Need help understanding exception...

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Feb 20 17:06:16 PST 2016


On 02/20/2016 04:45 PM, sanjayss wrote:
 > I got the following exception on a line of code that is basically "line
 > = readln()" and need help in understanding what the exception is saying.
 > (I am playing around with stdio prior to this using unix ioctls and
 > maybe I am messing something up in the process resulting in this, but
 > understanding the exception will give me a clue as to what I am doing
 > wrong -- a basic D progam with readln() doesn't have the same issue).
 > This is on linux with DMD version 2.07.
 >
 > std.stdio.StdioException at std/stdio.d(3969)
 > ----------------
 > ??:? void std.stdio.StdioException.opCall() [0x4c8891]
 > ??:? ulong std.stdio.readlnImpl(shared(core.stdc.stdio._IO_FILE)*, ref
 > char[], dchar, std.stdio.File.Orientation) [0x4c89e5]

Judging frome the fact that the exception object does not contain a 
message, it must be coming from one of several of the following checks:

         if (ferror(fps))
             StdioException();

For example:

 
https://github.com/D-Programming-Language/phobos/blob/master/std/stdio.d#L4180

And the only meaning is that the input stream is in error state. :-/

Ali



More information about the Digitalmars-d-learn mailing list