Hey,
I am having a problem with saving a file using c#. I am using the following code to save a xml file. I want the file to be saved right next to where the .exe file is. The following works most of the time, but if I use a SaveFileDialog anywhere else in the program, the path that I set there is used when saved the settings file as well and I cant understand why. Any ideas on why it is happending?
Code:
private void saveSettings()
{
string output = "<?xml version=\"1.0\" encoding='UTF-8'?>\n";
output += "<Settings>\n";
output += "\t<fps>" + m_fps.ToString() + "</fps>\n";
output += "\t<pivSize>" + m_pivotSize.ToString() + "</pivSize>\n";
output += "\t<rectLineWidth>" + m_rectLineWidth.ToString() + "</rectLineWidth>\n";
output += "\t<vertexLineWidth>" + m_vertexLineWidth.ToString() + "</vertexLineWidth>\n";
output += "\t<vertexSize>" + m_vertexSize.ToString() + "</vertexSize>\n";
output += "\t<makeHeader>" + m_makeHeaderFile.ToString() + "</makeHeader>\n";
output += "\t<headerFilePath>" + m_headerFilePath + "</headerFilePath>\n";
output += "</Settings>";
// Write the whole thing
TextWriter tw = new StreamWriter("Settings.xml");
tw.WriteLine(output);
tw.Close();
}
Regards,