digitalmars.D.learn - Why foreach do not print value during every single Insert request in
- Suliman (17/17) Jan 15 2015 void IMGsInsert(string [] fullimgurl)
- Rikki Cattermole (3/19) Jan 15 2015 That writeln won't be helping anything. Other then that?
- Vladimir Panteleev (4/21) Jan 15 2015 Terminal output is line-buffered by default. To display an
void IMGsInsert(string [] fullimgurl) { foreach (url; fullimgurl) { string sqlinsert = (sqlrequest) writeln(sqlinsert); write("|"); auto rs = stmt.executeUpdate(sqlinsert); } } I expect nice progress indicator "|" which move forward after every Insert request. Like: |||| and so on. The problem that App wait some time and only in prints a heap of "|". Why?
Jan 15 2015
On 16/01/2015 1:05 a.m., Suliman wrote:void IMGsInsert(string [] fullimgurl) { foreach (url; fullimgurl) { string sqlinsert = (sqlrequest) writeln(sqlinsert); write("|"); auto rs = stmt.executeUpdate(sqlinsert); } } I expect nice progress indicator "|" which move forward after every Insert request. Like: |||| and so on. The problem that App wait some time and only in prints a heap of "|". Why?That writeln won't be helping anything. Other then that? No idea sorry.
Jan 15 2015
On Thursday, 15 January 2015 at 12:05:24 UTC, Suliman wrote:void IMGsInsert(string [] fullimgurl) { foreach (url; fullimgurl) { string sqlinsert = (sqlrequest) writeln(sqlinsert); write("|"); auto rs = stmt.executeUpdate(sqlinsert); } } I expect nice progress indicator "|" which move forward after every Insert request. Like: |||| and so on. The problem that App wait some time and only in prints a heap of "|". Why?Terminal output is line-buffered by default. To display an incomplete line to the user, add "stdout.flush()" after your "write" call.
Jan 15 2015