If you want the STL style with first and second, do this:
for(auto e : extensions.toStdMap())
{
fout << e.first << "," << e.second << '\n';
}
If you want to use what Qt offers, do this:
for(auto e : extensions.keys())
{
fout << e << "," << extensions.value(e) << '\n';
}