PDA

View Full Version : Loop devices with qstring and qfile pls



davinciomare
3rd October 2016, 17:45
Hi i am trying to show all my devices with this code:


void MainWindow::listarUnidades()
{ /** Esta función envia por socket una lista de las unidades de almacenamiento del sistema **/
int i;
QString unidades = "unidades|@|";
QFileInfoList listaUnidades = directorio.drives();
for (i=0;i<listaUnidades.size();i++){
unidades = unidades + listaUnidades[i].absoluteFilePath() + "|@|";
}
cliente.sendMessage(from,unidades);
}

But when i try to create one qstring unidades like this:
QString unidades = QDir::drives();

show me this error:
C:\Users\moh\Desktop\Demonio_3.0_src (1)\Demonio_3.0_src\src\servidor\mainwindow.cpp:57 3: error: C2065: 'unidades' : identificador no declarado

I need take the device that i am using too. thx

Added after 34 minutes:

solved solved