Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ overwrite file

#include <fstream>

int main ()
{
   std::ofstream ofs("test.txt", std::ofstream::trunc);

   ofs << "lorem ipsum";

   ofs.close();
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: prints all the keys and values in a map c++ 
Cpp :: how to speed up cin and cout 
Cpp :: how to change certain number from set c++ 
Cpp :: how to sort a string in c++ 
Cpp :: differency between c++ std and stl 
Cpp :: convert whole string to uppercase c++ 
Cpp :: newline in c++ 
Cpp :: sort in descending order c++ stl 
Cpp :: pass c++ 
Cpp :: remove value from vector c++ 
Cpp :: n queens c++ 
Cpp :: how to access struct variables in c++ 
Cpp :: qstring to char* 
Cpp :: Write C++ program to copy one string to another string using pointers 
Cpp :: hello world C++, C plus plus hello world 
Cpp :: convert decimal to binary c++ 
Cpp :: findung the mode in c++ 
Cpp :: how to get command arguments c++ 
Cpp :: c++ competitive programming mst 
Cpp :: double to string c++ 
Cpp :: remove last character from string c++ 
Cpp :: find last occurrence of character in string c++ 
Cpp :: c++ code for quicksort 
Cpp :: how to get length of a file in c++ 
Cpp :: c++ pointer null vs nullptr 
Cpp :: c++ add object to array 
Cpp :: c++ function for checking if a sting is a number 
Cpp :: how to iterate throguh a string in c++ 
Cpp :: how to erase a certain value from a vector in C++ 
Cpp :: c++ clear char array 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =