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. Bind different files program Qt
Forum Updated to NodeBB v4.3 + New Features

Bind different files program Qt

Scheduled Pinned Locked Moved General and Desktop
18 Posts 3 Posters 3.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.
  • RIVOPICOR Offline
    RIVOPICOR Offline
    RIVOPICO
    wrote on last edited by
    #5

    Yeah but i can change the resources of one executable with Qt in one only executable without touch my other's. And it's possible like https://www.youtube.com/watch?v=sWIQIi4lg58
    But i dont know how i can do this with only using one textview and pushbutton. And then include like resource and then read this resource in my executable archivosalida.

    1 Reply Last reply
    0
    • RIVOPICOR Offline
      RIVOPICOR Offline
      RIVOPICO
      wrote on last edited by RIVOPICO
      #6

      Or if it is difficult maybe i can set the filename of archivosalida with icon included and then i will get the file with the resources included.

      1 Reply Last reply
      0
      • RIVOPICOR Offline
        RIVOPICOR Offline
        RIVOPICO
        wrote on last edited by RIVOPICO
        #7

        ok i change that:

        QByteArray trama(1024,'0'); -> QByteArray trama;
        archivoSalida.write(trama,1024); -> archivoSalida.write(trama):
        

        If i change this:
        QByteArray trama(1024,'0'); -> QByteArray trama;

        I get this error:
        alt text

        the strange thing i can join files of 100 MB or without any limit using one trama of 1024 bytes¿? LOL

        jsulmJ 1 Reply Last reply
        0
        • RIVOPICOR RIVOPICO

          ok i change that:

          QByteArray trama(1024,'0'); -> QByteArray trama;
          archivoSalida.write(trama,1024); -> archivoSalida.write(trama):
          

          If i change this:
          QByteArray trama(1024,'0'); -> QByteArray trama;

          I get this error:
          alt text

          the strange thing i can join files of 100 MB or without any limit using one trama of 1024 bytes¿? LOL

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #8

          @RIVOPICO Try

          archivoSalida.write(trama, trama.size());
          
          RIVOPICOR 2 Replies Last reply
          0
          • jsulmJ jsulm

            @RIVOPICO Try

            archivoSalida.write(trama, trama.size());
            
            RIVOPICOR Offline
            RIVOPICOR Offline
            RIVOPICO
            wrote on last edited by
            #9

            @jsulm it's strange but when i bind files in linux works and when i compile for windows bind files but not seem's to do the functions that i use.

            1 Reply Last reply
            0
            • jsulmJ jsulm

              @RIVOPICO Try

              archivoSalida.write(trama, trama.size());
              
              RIVOPICOR Offline
              RIVOPICOR Offline
              RIVOPICO
              wrote on last edited by RIVOPICO
              #10

              @jsulm But how i can put the size of my trama in my stub if i dont know the size??? Because i can change in my binder but i must to put the size of my trama to read the files.

              jsulmJ 1 Reply Last reply
              0
              • RIVOPICOR RIVOPICO

                @jsulm But how i can put the size of my trama in my stub if i dont know the size??? Because i can change in my binder but i must to put the size of my trama to read the files.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #11

                @RIVOPICO I don't understand the problem. If you put something into QByteArray then that array knows its size and you can get it calling size() method as shown before.

                RIVOPICOR 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @RIVOPICO I don't understand the problem. If you put something into QByteArray then that array knows its size and you can get it calling size() method as shown before.

                  RIVOPICOR Offline
                  RIVOPICOR Offline
                  RIVOPICO
                  wrote on last edited by RIVOPICO
                  #12

                  @jsulm yeah but if you check in the stub you will see these lines:

                  archivoStub->seek(archivoStub->size() - 1024);
                  trama = archivoStub->read(1024);
                  

                  I'm extracting my trama and then i read it. I can put trama size in my binder. But in my stub how i can read this trama? Because if i put 1024 i know the size and i can extract this trama and then read it. But if i dont know my trama how my stub can read my trama? Because if i dont know where is the trama will show me list outrange. So in other words if i want to read my trama i must to know this size of my trama or include something in my stub to get the size of this trama.

                  Yeah i know but im trying to say that i seek my trama, i extract my trama because i know the size in my case i only put with 1024 bytes but i dont know if the size is more big (undefined)how my stub can know this size of trama? so i think my stub can't know the size of my trama.

                  jsulmJ 2 Replies Last reply
                  0
                  • RIVOPICOR RIVOPICO

                    @jsulm yeah but if you check in the stub you will see these lines:

                    archivoStub->seek(archivoStub->size() - 1024);
                    trama = archivoStub->read(1024);
                    

                    I'm extracting my trama and then i read it. I can put trama size in my binder. But in my stub how i can read this trama? Because if i put 1024 i know the size and i can extract this trama and then read it. But if i dont know my trama how my stub can read my trama? Because if i dont know where is the trama will show me list outrange. So in other words if i want to read my trama i must to know this size of my trama or include something in my stub to get the size of this trama.

                    Yeah i know but im trying to say that i seek my trama, i extract my trama because i know the size in my case i only put with 1024 bytes but i dont know if the size is more big (undefined)how my stub can know this size of trama? so i think my stub can't know the size of my trama.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #13
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • RIVOPICOR RIVOPICO

                      @jsulm yeah but if you check in the stub you will see these lines:

                      archivoStub->seek(archivoStub->size() - 1024);
                      trama = archivoStub->read(1024);
                      

                      I'm extracting my trama and then i read it. I can put trama size in my binder. But in my stub how i can read this trama? Because if i put 1024 i know the size and i can extract this trama and then read it. But if i dont know my trama how my stub can read my trama? Because if i dont know where is the trama will show me list outrange. So in other words if i want to read my trama i must to know this size of my trama or include something in my stub to get the size of this trama.

                      Yeah i know but im trying to say that i seek my trama, i extract my trama because i know the size in my case i only put with 1024 bytes but i dont know if the size is more big (undefined)how my stub can know this size of trama? so i think my stub can't know the size of my trama.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #14

                      @RIVOPICO Well, if the size of what you want to read is variable then you need to specify a format. For example you can first put an integer into your file specifying the size and then trama of that size, then again size and trama and so on:
                      SIZE1TRAMA1SIZE2TRAMA2
                      Then you know how to interpret what you're reading.
                      For such stuff it is better to use QDataStream instead of QFile directly.

                      QFile file("file.dat");
                      file.open(QIODevice::ReadOnly);
                      QDataStream in(&file);
                      int size;
                      // Do the following in a loop until finished reading
                      in >> size;
                      char buffer[BUFFER_SIZE];
                      in.readRawData(buffer, size);
                      
                      RIVOPICOR 1 Reply Last reply
                      2
                      • jsulmJ jsulm

                        @RIVOPICO Well, if the size of what you want to read is variable then you need to specify a format. For example you can first put an integer into your file specifying the size and then trama of that size, then again size and trama and so on:
                        SIZE1TRAMA1SIZE2TRAMA2
                        Then you know how to interpret what you're reading.
                        For such stuff it is better to use QDataStream instead of QFile directly.

                        QFile file("file.dat");
                        file.open(QIODevice::ReadOnly);
                        QDataStream in(&file);
                        int size;
                        // Do the following in a loop until finished reading
                        in >> size;
                        char buffer[BUFFER_SIZE];
                        in.readRawData(buffer, size);
                        
                        RIVOPICOR Offline
                        RIVOPICOR Offline
                        RIVOPICO
                        wrote on last edited by
                        #15

                        @jsulm yeah this i was trying. because if i put the size and then i can read this size, i can read my trama too. But i have some doubts, this code is for reading or for including the size of my data? sorry for all!

                        jsulmJ ? 2 Replies Last reply
                        0
                        • RIVOPICOR RIVOPICO

                          @jsulm yeah this i was trying. because if i put the size and then i can read this size, i can read my trama too. But i have some doubts, this code is for reading or for including the size of my data? sorry for all!

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #16

                          @RIVOPICO Reading

                          RIVOPICOR 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @RIVOPICO Reading

                            RIVOPICOR Offline
                            RIVOPICOR Offline
                            RIVOPICO
                            wrote on last edited by RIVOPICO
                            #17

                            @jsulm i was thinking to include other trama with the size of my real trama and then get the size of the real trama because my other trama has defined size. Other way will be with a format but i dont know if i can seek one file with format or how i can read this file included in my all files. Anyways i think int number doesn't take many space to be a problem, i think.

                            1 Reply Last reply
                            0
                            • RIVOPICOR RIVOPICO

                              @jsulm yeah this i was trying. because if i put the size and then i can read this size, i can read my trama too. But i have some doubts, this code is for reading or for including the size of my data? sorry for all!

                              ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #18

                              @RIVOPICO Is there a reason why you keep deleting your postings? Makes it pretty hard to follow the thread.

                              1 Reply Last reply
                              2

                              • Login

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