file io question

I'm trying to write an application where I ask the user for the text that goes inside their file and then what the file should be called. here so far is the code:

#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;


int _tmain(int argc, _TCHAR* argv[])
{
int number;
wchar_t* fileName [80];
printf("What should this file say?\n");
scanf("%d", &number);
printf("What should the file's name be?\n");
scanf("%s", fileName);
ofstream myfile;
myfile.open (fileName);
myfile << number;
myfile.close();
return 0;
}

my problem is when they try to save the file with the name they made, the
"myfile.open()" wants a constant and not a variable. how do I alter the code to make 'fileName' work as the file's name?
Now fileName is an array of 80 pointers to wide characters, while it should be an array of characters themselves. Though I'm not sure if you must use char, or if wchar_t is fine too. Try both.
wchar_t will not work with scanf or fstream::open

use char.
Topic archived. No new replies allowed.