All pastes #418644 Raw Edit

Anonymous

public text v1 · immutable
#418644 ·published 2007-03-31 19:12 UTC
rendered paste body
#include<iostream>
#include<fstream>
#include<string>

using namespace std;

void createTable()
{
	string tablename = "";
	char filename[25];
	ofstream fstr;
	int length;

	cout << "Please enter the name of the table:" << endl;
	cin >> tablename;

	length = tablename.length();
	tablename[length+1] = (char)".";
	tablename[length+2] = (char)"d";
	tablename[length+3] = (char)"a";
	tablename[length+4] = (char)"t";
	tablename[length+5] = NULL;
	length = tablename.length();

	for(int i = 0; i < length; i++)
	{
		filename[i] = tablename[i]; 
	}

	fstr.open(filename);
	fstr << "yaz baba yaz.";
	fstr.close();	
}

int main ()
{
	createTable();
	return 0;
}