Loop doesn't update listboxes until it is done iterating
- by Justen
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() );
}