Jump to content

[CPP] ifstream can not read file in zipped data.zip


tipforeveryone
 Share

Recommended Posts

I use ifstream to read a file which I used to save some configuration data

ifstream weaponData("Data/Weapons.dat");
	while (weaponData >> configVariable1 >> configVariable2 > ...){
    	//Some code
	}

I included *.dat files in to publish process and I got them in data.zip succesfully.

But it seems published game can not read those files. But if I create a same folder structure outside zipped package, my game can read it normally

How can I use ifstream to read files in zipped package ?

Link to comment
Share on other sites

You cannot read files from encrypted zip files. Otherwise the encryption would be pointless because you could just read anyone's game data!

Keep those files in your game folder instead of in a zip package.

  • Like 1
  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I had a similar issue once. I even thought of I used the engines stream functions, it would allow me to access my files within the zip files, but nope.

You could try to rename the file as a Lua file and phrase it as a standard text file. I did something like this in Luawerks.

Josh, hopefully you are thinking about this when it comes to the new engine. I'm sure people would want to package file formats that they are using with the new plugin feature. 

Cyclone - Ultra Game System - Component PreprocessorTex2TGA - Darkness Awaits Template (Leadwerks)

If you like my work, consider supporting me on Patreon!

Link to comment
Share on other sites

15 hours ago, gamecreator said:

I thought you could also put them into and encrypted (password-protected) zip and read them (your own, not one Leadwerks creates): https://www.leadwerks.com/community/topic/17491-loading-from-the-encrypted-data-file/?do=findComment&comment=113628

Yes, that is correct.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...