How do you create file with a variable in C++? -


I was wondering how to put a variable where is "example.txt" below :

  offstream file; File.open ("example.txt");  

Just put a variable there: - P

if you Use the std :: string and you need to get the .c_str () by using the const char * so that your options are The types are:

  const char * filename = "example.txt" file.open (filename);  

or:

  std :: string filename = "example.txt" file.open (filename.c_str ());  

Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -