diff --git a/src/include/pw3270cpp.h b/src/include/pw3270cpp.h index 3a44aa2..c3edfdc 100644 --- a/src/include/pw3270cpp.h +++ b/src/include/pw3270cpp.h @@ -204,6 +204,7 @@ int cmp_string_at(int row, int col, const char *text); int wait_for_string_at(int row, int col, const char *key, int timeout); int input_string(const char *str); + string get_contents(); inline operator string() { return get_string(); diff --git a/src/libpw3270cpp/session.cc b/src/libpw3270cpp/session.cc index fc41d2f..1873f05 100644 --- a/src/libpw3270cpp/session.cc +++ b/src/libpw3270cpp/session.cc @@ -686,6 +686,20 @@ return -1; } + string session::get_contents() + { + string rc = ""; + int rows = get_height(); + int cols = get_width(); + + for(int r = 0; r < rows; r++) { + rc += get_string_at(r+1,0,cols).c_str(); + rc += "\n"; + } + + return rc; + } + } diff --git a/src/libpw3270cpp/testprogram.cc b/src/libpw3270cpp/testprogram.cc index 0e78f95..b6e5fe6 100644 --- a/src/libpw3270cpp/testprogram.cc +++ b/src/libpw3270cpp/testprogram.cc @@ -70,6 +70,8 @@ cout << "\tIsReady: " << session->is_ready() << endl; cout << "\tString(1,2,26) " << session->get_string_at(1,2,26) << endl; + cout << "Conteúdo:" << endl << session->get_contents() << endl; + session->disconnect(); delete session; } -- libgit2 0.21.2