I'm really new to C++ and I need to convert a C# code to C++. I did almost all of it, but I'm a bit stuck with XML creation.
I got this code in C#:
public static void Save(string fileName, T obj)
{
DataContractSerializer serializer = new DataContractSerializer(typeof(T));
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true, IndentChars = " " };
try
{
using (XmlWriter writer = XmlWriter.Create(fileName, settings))
{
serializer.WriteObject(writer, obj);
}
}
catch (SerializationException e)
{
Trace.TraceError("Error serializing {0}: {1}", typeof(T).Name, e.Message);
throw;
}
}
What is the equivalent C++ code or libraries that can do the same?
Aucun commentaire:
Enregistrer un commentaire