Quantcast
Channel: Visual C forum
Viewing all articles
Browse latest Browse all 15302

using keyword

$
0
0
I would like to change this code
#include <fstream> 

int main () {

  std::fstream fs;

  fs.open ("test.txt", std::fstream::in | std::fstream::out | 
std::fstream::app);

  fs << " more lorem ipsum";

  fs.close();

  return 0;

}

-------
To look like this
#include <fstream>  
int main () {
  using my_read = std::fstream::in; //<== Error: expected type-specifier
  std::fstream fs;
  fs.open ("test.txt", my_read | std::fstream::out; | std::fstream::app);
  fs << " more lorem ipsum";
  fs.close();
  return 0;

}

What am I doing wrong?

Thanks in advance for your help

Viewing all articles
Browse latest Browse all 15302


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>