I'm trying to write an mpi program where each node knows its own `rank`, which is an integer.

I this program I hope each node to create a `.txt` file with its `rank` as the file name. That is, I hope the program to generate a file called `rank.txt` where rank is an integer.

I know how to convert an `int` to `string`, but I am quite confused about how I can combine that string with `.txt` and put it into a filename. What is the easiest way to do it?

Thanks in advance.

**EDIT**

I have combined the number with `.txt` and put them into a string `filename` but when I typed `std::ofstream out_stream(filename)` the compiler tells me that 

```
no matching constructor for initialization `std::outstream`

```

How can I put the string into a filename?