Commit a75915786222ea47cae8855953f6f97d6557205f
1 parent
17556c0b
Exists in
master
Corrigindo problema na leitura de tela completa.
Showing
2 changed files
with
7 additions
and
5 deletions
Show diff stats
src/native/screen.cc
... | ... | @@ -37,10 +37,12 @@ int tn3270_get_string(h3270::session *ses, int addr, char* str, int strlen) { |
37 | 37 | return 0; |
38 | 38 | } |
39 | 39 | |
40 | -int tn3270_get_string_at(h3270::session *ses, int row, int col, char* str, int strlen) { | |
41 | - memset(str,0,strlen); | |
42 | - strncpy(str,ses->get_string_at(row,col,strlen).c_str(),strlen); | |
43 | - return 0; | |
40 | +int tn3270_get_string_at(h3270::session *ses, int row, int col, char* str, int sz) { | |
41 | + memset(str,0,sz); | |
42 | + strncpy(str,ses->get_string_at(row,col,sz).c_str(),sz); | |
43 | + str[sz] = 0; | |
44 | + debug("%s(%d,%d) len=%u (Required=%d)\n",__FUNCTION__,row,col,(unsigned int) strlen(str), sz); | |
45 | + return (int) strlen(str); | |
44 | 46 | } |
45 | 47 | |
46 | 48 | int tn3270_set_string_at(h3270::session *ses, int row, int col, const char* str) { | ... | ... |
src/pw3270-sharp/pw3270-sharp.cs
... | ... | @@ -306,7 +306,7 @@ namespace pw3270 { |
306 | 306 | public string GetStringAt(int row, int col, int strlen) { |
307 | 307 | StringBuilder str = new StringBuilder(strlen+1); |
308 | 308 | tn3270_get_string_at(hSession, row, col, str, strlen); |
309 | - return str.ToString(0,strlen); | |
309 | + return str.ToString(); | |
310 | 310 | } |
311 | 311 | |
312 | 312 | /// <summary> | ... | ... |