Jump to content
  • Advertisement
Sign in to follow this  
Rozik

Opening a Textfile thats loaded to memory

This topic is 4436 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone, I am useing sourcefiles for my resource files some of which are textfiles. Which are loaded to memory like this:
CZipFile *zipFile=new CZipFile();
	if(zipFile->Init(resfile)){
		int index = zipFile->Find(path);
		int size = zipFile->GetFileLen(index);
		BMPdata = new char[size];
		if(BMPdata){
			zipFile->ReadFile(index, BMPdata);
		}
		else{
			ThrowError::Error("Could not open Resfile");
		}
	}else{
		ThrowError::Error("Could not open Resfile");
	}	

So the file is in memory afterwards in the BMPdata variable. With pictures i can just call LoadTextureFromFileInMemory. But how do i access a textfile thats in memory? Thx a lot in advance Rozik

Share this post


Link to post
Share on other sites
Advertisement
You should try breaking the problem down into steps. After the text file has been read in, you will have to tokenize it into a list of usable strings. Then you will have to parse the tokens according to whatever format your data is ordered in.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!