From 4f9fd340f0f76aedba431491118addd1372ecb7c Mon Sep 17 00:00:00 2001 From: Guilhem Lavaux Date: Mon, 15 Apr 2013 08:49:42 -0400 Subject: [PATCH] Indicate at which point of the text stream is the failure --- c_tools/libzobov/loadZobov.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/c_tools/libzobov/loadZobov.cpp b/c_tools/libzobov/loadZobov.cpp index a1a6cbb..e34ef45 100644 --- a/c_tools/libzobov/loadZobov.cpp +++ b/c_tools/libzobov/loadZobov.cpp @@ -134,11 +134,15 @@ bool loadZobov(const char *descName, const char *adjName, const char *voidsName, } cout << "Loading description" << endl; + int lineid = 1; string line; getline(descFile, line); + lineid++; getline(descFile, line); + lineid++; getline(descFile, line); + lineid++; while (!descFile.eof()) { istringstream lineStream(line.c_str()); @@ -160,7 +164,7 @@ bool loadZobov(const char *descName, const char *adjName, const char *voidsName, >> probability; if (!lineStream) { - cerr << "Error in text stream" << endl; + cerr << "Error in text stream at line " << lineid << endl; abort(); } @@ -187,6 +191,7 @@ bool loadZobov(const char *descName, const char *adjName, const char *voidsName, << actualNumber << ")" << endl; } getline(descFile, line); + lineid++; } cout << "Done loading" << endl;