Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8178421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:45:46+00:00 2026-06-06T23:45:46+00:00

I’m looking in PhysicsFS documentation and search for way to archive and compress data

  • 0

I’m looking in “PhysicsFS” documentation and search for way to archive and compress data but can’t find.Is it possible and if it is how i can do that

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:45:48+00:00Added an answer on June 6, 2026 at 11:45 pm

    PhysicsFS zip support

    PhysicsFS has support for reading files from a zip file mounted at an arbitrary point in the “virtual filesystem” that it provide. This effectively provide decompression from a ZIP archive.

    However, PhysicsFS has no support to add or modify the content of a ZIP archive. It only permit to write uncompressed files in what is called “the write directory” in its documentation.

    So, to summarize: PhysicsFS only support reading from ZIP archives, not writing to it.
    For the compression you are on your own: just zip all the written files using an external compressor if you need so.


    PhysicsFS usage

    There is a small tutorial for PhysicsFS here.

    It is very simple to use:

    // initialize the lib
    PHYSFS_init(NULL);
    
    // "mount" a zip file in the root directory
    PHYSFS_AddToSearchPath("myzip.zip", 1);
    
    // set a directory for writing
    PHYSFS_setWriteDir(const char *newDir);
    
    // open a file for reading
    PHYSFS_file* myfile = PHYSFS_openRead("myfile.txt");
    
    // open a file for writing
    PHYSFS_file* myfile = PHYSFS_openWrite("output_file.bin");
    
    // get a file size
    PHYSFS_sint64 file_size = PHYSFS_fileLength(myfile);
    
    // read data from a file (decompress only if path is inside a zip mount point)
    char* myBuf = new char[file_size];
    int length_readed = PHYSFS_read(myfile, myBuf, 1, file_size);
    
    // write data to a file (uncompressed)
    char* myBuf = new char[new_file_size];
    //...fill myBuf...
    int length_writed = PHYSFS_write(myfile, myBuf, 1, new_file_size);
    
    // close a file
    PHYSFS_close(myfile);
    
    // deinitialize the lib
    PHYSFS_deinit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want to construct a data frame in an Rcpp function, but when I
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.