Loop doesn't update listboxes until it is done iterating
Posted
by Justen
on Stack Overflow
See other posts from Stack Overflow
or by Justen
Published on 2010-06-02T14:09:49Z
Indexed on
2010/06/02
14:14 UTC
Read the original article
Hit count: 331
I have a loop that takes file name from a listbox, performs a system() call, then moves that filename to another listbox. Problem is, it doesn't move the filenames over one at a time, but waits until the entire loop is finished and moves them all at once. What would I do to get it to perform how I want it to?
the loop:
for each( String^% file in filename )
{
int x = convert( file );
lbComplete->Items->Add( lbFiles->Items[0] ); // place the completed file
lbFiles->Items->Remove( lbFiles->Items[0] ); // in the other listbox
}
The function convert() that contains the system call:
int convert( String^ file )
{
std::stringstream ss;
std::string dir, fileAddress, fileName, outputDir;
...
return system( ss.str().c_str() );
}
© Stack Overflow or respective owner