Results 1 to 1 of 1

Thread: Loop devices with qstring and qfile pls

  1. #1
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Re: Loop devices with qstring and qfile pls

    Hi i am trying to show all my devices with this code:
    Qt Code:
    1. void MainWindow::listarUnidades()
    2. { /** Esta función envia por socket una lista de las unidades de almacenamiento del sistema **/
    3. int i;
    4. QString unidades = "unidades|@|";
    5. QFileInfoList listaUnidades = directorio.drives();
    6. for (i=0;i<listaUnidades.size();i++){
    7. unidades = unidades + listaUnidades[i].absoluteFilePath() + "|@|";
    8. }
    9. cliente.sendMessage(from,unidades);
    10. }
    To copy to clipboard, switch view to plain text mode 
    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
    Last edited by anda_skoa; 6th October 2016 at 15:45. Reason: missing [code] tags

Similar Threads

  1. Replies: 5
    Last Post: 5th December 2015, 11:22
  2. Replies: 2
    Last Post: 6th May 2013, 08:06
  3. QFile & QString().arg() Problems
    By Jonathan Maen in forum Newbie
    Replies: 3
    Last Post: 21st January 2012, 21:15
  4. Replies: 4
    Last Post: 6th August 2011, 01:40
  5. Creating QFile Objects in a loop
    By sky in forum Newbie
    Replies: 1
    Last Post: 3rd December 2010, 08:27

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.