0

I have this function in C++:

void file_to_vect(double * a, char * name_file);

that takes in input a vector and writes it on the file whose name is specified by name_file. The problem is that I want to use this function on a file whose name changes. For example

file_to_vect(a,"file_18.txt")

Where the number after "file_" is not fixed. I've tried to do that by:

int n=18;
file_to_vect(a,"file_"+char(n)+".txt");

But it doesn't work. Any suggestion on how to fix this?

2
  • Do you know how to use std::ostringstream, std::string, and/or std::to_string? Commented Jan 13, 2022 at 12:06
  • 1
    your question is: How to concatenate strings? Commented Jan 13, 2022 at 12:06

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.