Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Quint32 to char []
Forum Updated to NodeBB v4.3 + New Features

Quint32 to char []

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    glararan
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dbzhang800
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • E Offline
        E Offline
        elephanten
        wrote on last edited by
        #3

        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
        

        }
        @

        1 Reply Last reply
        0
        • G Offline
          G Offline
          glararan
          wrote on last edited by
          #4

          elephant... thank you.. working

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved