Manual input works, reading from txt file causes infinite loop java -



Manual input works, reading from txt file causes infinite loop java -

i apologize in advance similarity between question , many others, after checking through , trying solutions other questions, i've yet solve issue. next test code provided testing sap class princeton assignment wordnet(found here http://www.cs.princeton.edu/courses/archive/fall14/cos226/assignments/wordnet.html )

public static void main(string[] args) { in in = new in(args[0]); digraph g = new digraph(in); sap sap = new sap(g); while (!stdin.isempty()) { int v = stdin.readint(); int w = stdin.readint(); int length = sap.length(v, w); int ancestor = sap.ancestor(v, w); stdout.printf("length = %d, ancestor = %d\n", length, ancestor); } }

for reason, using test code gives me infinite loop when seek pass text files (an illustration txt file can found here: ftp://ftp.cs.princeton.edu/pub/cs226/wordnet/digraph1.txt).

since code given me assignment page, assume right. leads me question, else in code causing infinite loop? i'm unsure of check besides while loop of test code.

in addition, how passing text file wrong? steps took pass digraph1.txt

run -> run configurations sap class

and arguments set in ${file_prompt} , chose digraph1.txt each time.

when manually come in in digraph1.txt of methods work fine.

thanks in advance!

java input inputstream infinite-loop wordnet

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -