Answers for "fstream open c++"

C++
4

fstream in c++

#include<fstream>
int main()
{
  fstream file; 
  /*if we use fstream then we need to specify at least one 
  parameter mode like ios::out or ios::in else the file will not open */  
  file.open("filename.txt", ios::out|ios::in);
  /*all work with file*/
  file.close();
  return 0;
}
Posted by: Guest on March-26-2021
-1

flags of open operation c++

in	input	File open for reading: the internal stream buffer supports input operations.
out	output	File open for writing: the internal stream buffer supports output operations.
binary	binary	Operations are performed in binary mode rather than text.
ate	at end	The output position starts at the end of the file.
app	append	All output operations happen at the end of the file, appending to its existing contents.
trunc	truncate	Any contents that existed in the file before it is open are discarded.
Posted by: Guest on November-13-2020

Browse Popular Code Answers by Language