Jump to content

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

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 ?

Share this post

Link to post

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

Share this post

Link to post

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. 

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

  • Create New...