public void writestack()
	{
		File f=new File(name+".stack.back");
		if (f.exists())
			if (!f.delete())
			{
				printer.PrintMessage("failed to delete "+name+".stack.back");
				return;
			}
		f= new File(name+".stack");
		if (f.exists())
		{
			if (!f.renameTo(new File(name+".stack.back")))
			{
				printer.PrintMessage("failed to rename "+name+".stack");
				return;
			}
		}
		f= new File(name+".stack");
		try
		{
			f.createNewFile();
		} catch (IOException e)
		{
			printer.PrintMessage("failed to create "+name+".stack");
			return;
		}
		try
		{
			BufferedWriter out = new BufferedWriter(new FileWriter(name+".stack", true));
			for(Moneys m: money)
			{
				out.write(m.owner+" "+m.amount+"\r\n");
			}
			out.close();
			f=new File(name+".stack.back");
			if (f.exists())
				if (!f.delete())
				{
					printer.PrintMessage("failed to delete "+name+".stack.back");
					return;
				}
		}
		catch (IOException e)
		{
			printer.PrintMessage("failed to write to "+name+".stack");
		}
	}