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. Copying two files in a third one...
Forum Updated to NodeBB v4.3 + New Features

Copying two files in a third one...

Scheduled Pinned Locked Moved General and Desktop
41 Posts 4 Posters 24.4k 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.
  • C Offline
    C Offline
    croussou
    wrote on last edited by
    #23

    Aha, okay I get it now thanks. What about .zip files, that's what I am mostly interested about...

    Can I zip a file through my application? For example, there is a button for file creation, then another one checking if the file really exists and then a button called add to archive, where I put the file in question, in a .7z, .rar archive.

    Regards,

    croussou

    1 Reply Last reply
    0
    • C Offline
      C Offline
      croussou
      wrote on last edited by
      #24

      [quote author="Tobias Hunger" date="1329983973"]Never assume that the user of your application will only ever use it for what you anticipate!

      If your application can concatenate two files some user will end up trying to concatenate two blueray films with it;-)[/quote]

      Hehe, nice one indeed! The thing is that the user will not be able to select the files for concatenation. It would be predetermined in the application code, so that is not a big issue.

      Regards,

      croussou

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #25

        Well, it is not like something REALLY bad will happen, worst case scenario the procedure will fail in numerous possible ways. Luckily no one's foot will be literally shot off :)

        1 Reply Last reply
        0
        • C Offline
          C Offline
          croussou
          wrote on last edited by
          #26

          How about the zipping files question? Any info on that one? :)

          Regards,

          croussou

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

            [quote author="croussou" date="1329984083"]Aha, okay I get it now thanks. What about .zip files, that's what I am mostly interested about...

            Can I zip a file through my application? For example, there is a button for file creation, then another one checking if the file really exists and then a button called add to archive, where I put the file in question, in a .7z, .rar archive.[/quote]

            No, it will not work with archives such as zip or 7z. Archives have headers as well. Those headers describe which files or folders are in the archive, and where their data can be found inside the file.

            1 Reply Last reply
            0
            • ? This user is from outside of this forum
              ? This user is from outside of this forum
              Guest
              wrote on last edited by
              #28

              According to "wikipedia":http://en.wikipedia.org/wiki/Zip_(file_format)#File_headers, the .zip file format DOES feature a header that contains plenty of information:

              bq. 0 4 Local file header signature = 0x04034b50 (read as a little-endian number)
               4 2 Version needed to extract (minimum)
               6 2 General purpose bit flag
               8 2 Compression method
              10 2 File last modification time
              12 2 File last modification date
              14 4 CRC-32
              18 4 Compressed size
              22 4 Uncompressed size
              26 2 File name length (n)
              28 2 Extra field length (m)
              30 n File name

              It is pretty much safe to assume if you use this method to join two zip files you will get what MIGHT appear as a good file, but IT WILL BE CORRUPTED.

              1 Reply Last reply
              0
              • C Offline
                C Offline
                croussou
                wrote on last edited by
                #29

                It was mostly a general question, if there is any way for an application to provide files in an archive :)
                Not about concatenation itself...just the zipping process.

                Regards,

                croussou

                1 Reply Last reply
                0
                • ? This user is from outside of this forum
                  ? This user is from outside of this forum
                  Guest
                  wrote on last edited by
                  #30

                  You have no option but use the archive format API to merge two archives together.

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    croussou
                    wrote on last edited by
                    #31

                    [quote author="ddriver" date="1329984668"]You have no option but use the archive format API to merge two archives together.[/quote]

                    I don't want to merge :) I just want to save a file that I read from my application in a .zip format. For example a text file, I want to be able to add it in an archive on the desktop through the app that is.

                    Regards,

                    croussou

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

                      [quote author="croussou" date="1329984584"]It was mostly a general question, if there is any way for an application to provide files in an archive :)
                      Not about concatenation itself...just the zipping process.[/quote]
                      Grmbl!
                      Then please, why do you only say that now? Why do you send us down a different road, trying to answer the question you asked instead of the question you have? Please spend a bit more time formulating your actual question in the future; describe what you want to achieve, not how you think you might achieve it. That will make us spend our time more efficiently.

                      Anyway, working with ZIP files is a "FAQ":http://developer.qt.nokia.com/faq/answer/how_to_compress_data_with_qt on this site. There is "plenty":http://developer.qt.nokia.com/search?search=zip to be found on this site on this topic.

                      1 Reply Last reply
                      0
                      • ? This user is from outside of this forum
                        ? This user is from outside of this forum
                        Guest
                        wrote on last edited by
                        #33

                        Again, you have to use the format API. Or reimplement everything yourself which is not really applicable.

                        Luckily most archive formats have an open API so they can easily be integrated.

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          croussou
                          wrote on last edited by
                          #34

                          Well, I certainly apologize for misleading you. I was just trying to explain what I want to achieve...obviously did not come out in the right way.

                          Regards,

                          croussou

                          1 Reply Last reply
                          0
                          • ? This user is from outside of this forum
                            ? This user is from outside of this forum
                            Guest
                            wrote on last edited by
                            #35

                            Relax, we are all flawed by design - that is what life is for, polishing those flaws ;)

                            Take a look here:
                            http://www.7-zip.org/sdk.html

                            bq. LZMA SDK includes:
                            C++ source code for .7z compression and decompression (reduced version)

                            This is no longer Qt territory, but you can easily integrate the 7zip library and use it in your Qt project.

                            1 Reply Last reply
                            0
                            • C Offline
                              C Offline
                              croussou
                              wrote on last edited by
                              #36

                              Thank you.

                              Looks interesting indeed. I will have a look, although I am not sure that I can use it that easily :)

                              Regards,

                              croussou

                              1 Reply Last reply
                              0
                              • ? This user is from outside of this forum
                                ? This user is from outside of this forum
                                Guest
                                wrote on last edited by
                                #37

                                You cannot expect others to write all your code for you, you have to learn it for yourself, and it does take time. Even if your get all the code snippets from others, without the proper skills you will not be able to put them together in a working program. Rome wasn't built overnight you know ;)

                                1 Reply Last reply
                                0
                                • C Offline
                                  C Offline
                                  croussou
                                  wrote on last edited by
                                  #38

                                  Definitely, no doubt about that. It's just the best way for me to learn is by reading theory but mostly examples. Then you can apply the similar functionality to your application :)

                                  Regards,

                                  croussou

                                  1 Reply Last reply
                                  0
                                  • ? This user is from outside of this forum
                                    ? This user is from outside of this forum
                                    Guest
                                    wrote on last edited by
                                    #39

                                    A final word of advice, don't think, not even for a moment, that you will be able to avoid the hard work of digging through the documentation, all the examples you see cover at best the very basics, learning to find what you need in the DOC is MANDATORY if you really intend to become a programmer.

                                    Good luck.

                                    1 Reply Last reply
                                    0
                                    • C Offline
                                      C Offline
                                      croussou
                                      wrote on last edited by
                                      #40

                                      Thanks for all the help you provided, much appreciated.

                                      Regards,

                                      croussou

                                      1 Reply Last reply
                                      0
                                      • J Offline
                                        J Offline
                                        JohnKaul
                                        wrote on last edited by
                                        #41

                                        wow. This thread went down a totally different path than I thought it would.

                                        #lol#

                                        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