Sign in to follow this  
sipickles

building filenames on the fly

Recommended Posts

Hi, I am a little puzzled on how to build filenames as a function runs. I am trying to pass a base filename to a function, then load filename_1, filename_2 etc
Cworld::Cworld( LPDIRECT3DDEVICE9 _Device, CHAR* filename, int _numSectors )
{
	m_lpDevice	= _Device;
	m_iNumSectors	= _numSectors;

	for ( int i = 0; i < m_iNumSectors; i++ )
	{
		char		sectorFilename[64];
		sprintf(sectorFilename,"data/terrain/%c_%i.x", &filename, i+1 );

		//do stuff
	}
}
however this isnot quite working, the char* isnt being converted into the string in the filename. eg output is "data/terrain/$_1.x" Can anyone help? Thanks in advance

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this