// Create a project instance System::SharedPtr newProject = System::MakeObject(); // Create a file stream { System::SharedPtr projectStream = System::MakeObject(dataDir + u"EmptyProjectSaveStream_out.xml", System::IO::FileMode::Create, System::IO::FileAccess::Write); // Clearing resources under 'using' statement System::Details::DisposeGuard<1> __dispose_guard_0({ projectStream}); // ------------------------------------------ try { // Write the stream into XML format newProject->Save(projectStream, Aspose::Tasks::Saving::SaveFileFormat::XML); } catch(...) { __dispose_guard_0.SetCurrentException(std::current_exception()); } }