I am currently working on a program that needs to create as many files as the user specifies and I was having a little problem with the naming of the file. I tried to use my count variable to assign a name but fstream will not accept it. So now I am trying to use a char pointer and the heap to hold names. I am more worried with getting the pointer and all to work before I start to worry about how I will assign a value to the where the pointer is pointing. My code so far-
Code:
#include <fstream>
#include <iostream>   //I know, I know, but VC++6 complains
using namespace std;

char CreateName(int num)
{
	if (!pName)
	{
		*pName = new char;
		*pName = num;
		return *pName;
	}
	else
	{
		delete pName;
		*pName = new char;
		*pName = num;
		return *pName;			
	}
}

int main()
{
	int amnt;
	cout << "How many files?: ";
                cin >> amnt;
	for(int i; i < amnt; i++)
	{
		ofstream newfile(CreateName(i));
		newfile.close();
	}
	return 0;
}
I am not even sure if char is an acceptable return value, I don't see why not though. But I have not been able to test this out on a compiler yet (I already know it would bring up errors).

How would I check to see if the pointer already exsisted so I know if I need to delete it or not before trying to create a new one? Or should I try something else for the naming?