Crash when using QFile::copy



  • Hello i am kinda in the same position as my friend.. This code:

    @
    if (!QDir(home_special).exists())
    {
    QDir dir;
    dir.mkpath(home_special);
    }
    else
    {

        QDir dir_get_all_pictures;
        dir_get_all_pictures.setPath(home_neobux);
        dir_get_all_pictures.setFilter(QDir::Files);
        QStringList filters;
        filters << "avatar*";
        QStringList all_files=dir_get_all_pictures.entryList(filters);
        int all_files_count = all_files.count();
        for (int i=0;all_files_count>i;i++)
            QFile&#40;home_special+all_files.at(i&#41;&#41;.remove(&#41;;
    }
    
    QFile::copy(path, home_special+"avatar"+fullname);
    ui->avatar_label->setPixmap(home_special+"avatar"+fullname);@
    

    What the code does is, if the directory doesn't exist create it and copy an image while renaming the image to avatar. If the folder exists delete everything that is on the folder and starts from avatar, then copy the image and rename it avatar. Well this code works perfectly in Ubuntu, i just tested it in Windows and i get:

    !http://i.imgur.com/jce49.png(1)!



  • @Leon: I think "home_special+"avatar"+fullname" need some seperator, correct me if I'm wrong.



  • [quote author="A.A.B.A" date="1348203790"]@Leon: I think "home_special+"avatar"+fullname" need some seperator, correct me if I'm wrong.[/quote]

    It wasn't the slashes problem.. the code i have posted here works perfectly, it was buggy in the part before this code :D..



  • Leon: please don't hijack other threads with "similar" problems. I splitted your messages.

    Could you please add a [solved] in this thread's title and a description of the solution? Thanks.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.