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. Converting void pointer to qstring
Forum Updated to NodeBB v4.3 + New Features

Converting void pointer to qstring

Scheduled Pinned Locked Moved General and Desktop
14 Posts 5 Posters 9.8k 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.
  • K Offline
    K Offline
    kitten
    wrote on last edited by
    #3

    no , the function is'nt my main function
    it is another function

    www.kitten.mihanblog.com

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #4

      the qApp pointer is globally accessible.

      (Z(:^

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kitten
        wrote on last edited by
        #5

        i know the qapp pointer is globally accessible but argv and argc is'nt argumens of my main functions
        i should write my code like this to more understand:
        @void func(const QString &gg,int argc,void *argv)
        {
        String paramlist;
        VARIANT params = (VARIANT)argv;
        for (int a = argc-1; a >= 0; --a) {
        if (a == argc-1)
        paramlist = QLatin1String(" - {");
        QVariant qvar = VARIANTToQVariant(params[a], 0);
        paramlist += QLatin1String(" ") + qvar.toString();
        if (a > 0)
        paramlist += QLatin1String(",");
        else
        paramlist += QLatin1String(" ");
        }
        if (argc)
        paramlist += QLatin1String("}");
        }@

        www.kitten.mihanblog.com

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goetz
          wrote on last edited by
          #6

          How should we know the problem? We do not even know what's behind your void pointer, not to mention what your VARIANT type is nor the VARIANTToQVariant and how it is organized.

          Oh, and your code would be much more readable, if you would use proper indenting. I would not find a bug in that mess either.

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kitten
            wrote on last edited by
            #7

            i know the void arguments is an integer but it get me error

            www.kitten.mihanblog.com

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #8

              Bravo! Now we know exceptionally more and can solve your problem...

              Sorry, for being sarcastic, but do your really expect that we can comment on your problem with that much information you gave us? Did you try yourself using a debugger and stepping through the code?

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on last edited by
                #9

                If yoiu areguments are integers, why do you cast them to VARIANT pointers? Are you talking about COM VARIANTS? If yes, it seams, you don't know their structure, they are not integers.

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kitten
                  wrote on last edited by
                  #10

                  yes it is a com variants
                  what should i do?

                  www.kitten.mihanblog.com

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    giesbert
                    wrote on last edited by
                    #11

                    That depends.
                    I have no idea how your input looks like.,
                    If it is ints, don't cast them to VARIANT!

                    Nokia Certified Qt Specialist.
                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      andre
                      wrote on last edited by
                      #12

                      You can only savely cast to a known data structure. If you don't have access to that structure (for instance by including a header describing the structure), there is no save way to cast to anything. So: find out what the input data is, and how it is represented. Only then start thinking about casting to it.

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        kitten
                        wrote on last edited by
                        #13

                        the documentation says it is a integer but
                        for example when it should send me 99 it get me 206
                        and when it should send me 200 it get me 63
                        i don't know what does it mean

                        www.kitten.mihanblog.com

                        1 Reply Last reply
                        0
                        • G Offline
                          G Offline
                          giesbert
                          wrote on last edited by
                          #14

                          We have no idea which program sends you messages and how to interpret them.
                          Contact the one who wrote it.

                          Nokia Certified Qt Specialist.
                          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                          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