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.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.
  • R Offline
    R Offline
    RIVOPICO
    wrote on 13 Dec 2016, 12:28 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
    • R Offline
      R Offline
      RIVOPICO
      wrote on 13 Dec 2016, 13:06 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
      • R Offline
        R Offline
        RIVOPICO
        wrote on 13 Dec 2016, 17:43 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

        J 1 Reply Last reply 14 Dec 2016, 05:22
        0
        • R RIVOPICO
          13 Dec 2016, 17:43

          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

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 14 Dec 2016, 05:22 last edited by
          #8

          @RIVOPICO Try

          archivoSalida.write(trama, trama.size());
          
          R 2 Replies Last reply 15 Dec 2016, 01:03
          0
          • J jsulm
            14 Dec 2016, 05:22

            @RIVOPICO Try

            archivoSalida.write(trama, trama.size());
            
            R Offline
            R Offline
            RIVOPICO
            wrote on 15 Dec 2016, 01:03 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
            • J jsulm
              14 Dec 2016, 05:22

              @RIVOPICO Try

              archivoSalida.write(trama, trama.size());
              
              R Offline
              R Offline
              RIVOPICO
              wrote on 15 Dec 2016, 12:12 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.

              J 1 Reply Last reply 15 Dec 2016, 12:14
              0
              • R RIVOPICO
                15 Dec 2016, 12:12

                @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.

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 15 Dec 2016, 12:14 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.

                R 1 Reply Last reply 15 Dec 2016, 12:20
                0
                • J jsulm
                  15 Dec 2016, 12:14

                  @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.

                  R Offline
                  R Offline
                  RIVOPICO
                  wrote on 15 Dec 2016, 12:20 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.

                  J 2 Replies Last reply 15 Dec 2016, 12:25
                  0
                  • R RIVOPICO
                    15 Dec 2016, 12:20

                    @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.

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 15 Dec 2016, 12:25 last edited by
                    #13
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • R RIVOPICO
                      15 Dec 2016, 12:20

                      @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.

                      J Offline
                      J Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on 15 Dec 2016, 12:34 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);
                      
                      R 1 Reply Last reply 15 Dec 2016, 12:52
                      2
                      • J jsulm
                        15 Dec 2016, 12:34

                        @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);
                        
                        R Offline
                        R Offline
                        RIVOPICO
                        wrote on 15 Dec 2016, 12:52 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!

                        J ? 2 Replies Last reply 15 Dec 2016, 12:53
                        0
                        • R RIVOPICO
                          15 Dec 2016, 12:52

                          @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!

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 15 Dec 2016, 12:53 last edited by
                          #16

                          @RIVOPICO Reading

                          R 1 Reply Last reply 15 Dec 2016, 12:59
                          0
                          • J jsulm
                            15 Dec 2016, 12:53

                            @RIVOPICO Reading

                            R Offline
                            R Offline
                            RIVOPICO
                            wrote on 15 Dec 2016, 12:59 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
                            • R RIVOPICO
                              15 Dec 2016, 12:52

                              @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 15 Dec 2016, 13:19 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

                              14/18

                              15 Dec 2016, 12:34

                              • Login

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