- ti_unique_file = fopen(filename.c_str(), "w");
- xbt_assert(ti_unique_file, "Tracefile %s could not be opened for writing: %s", filename.c_str(), strerror(errno));
- fprintf(tracing_file, "%s\n", filename.c_str());
+ ti_unique_file = new std::ofstream(filename.c_str(), std::ofstream::out);
+ xbt_assert(not ti_unique_file->fail(), "Tracefile %s could not be opened for writing", filename.c_str());
+ tracing_file << filename << std::endl;