Quint32 to char []



  • Hi, is any possible way how to convert quint32 to "char 123[quint32]"?

    I have from my friend code:
    @HANDLE hFile;
    quint32 fileSize;

    if(Loader::getInstance().SFileOpenFileEx(h, filename.toStdString().c_str(), 0, &hFile))
    {
    fileSize = Loader::getInstance().SFileGetFileSize(hFile);

    char fbuffer[fileSize];
    //                                          HANDLE, void*,  quint32, quint32
    Loader::getInstance().SFileReadFile(hFile, fbuffer, fileSize, 0);
    fbuffer[fileSize] = '\0';
    
    return QString(fbuffer);
    

    }@

    I try QVariant without success.



  • Sorry for my poor English, What do you mean by
    [quote author="glararan" date="1335810894"] convert quint32 to "char 123[quint32]"?
    [/quote]



  • Maybe all you need is dynamic array like that:
    @
    HANDLE hFile;
    quint32 fileSize;

    if(Loader::getInstance().SFileOpenFileEx(h, filename.toStdString().c_str(), 0, &hFile))
    {
    fileSize = Loader::getInstance().SFileGetFileSize(hFile);
    char *fbuffer;
    fbuffer = new char[fileSize];
    // alternative
    // fbuffer = calloc(1, fileSize);

    // other stuff
    

    }
    @



  • elephant... thank you.. working


Log in to reply
 

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