Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Truncation (Why does the text.txt not stay empty?)
Re: Truncation [message #46983 is a reply to message #46981] Sun, 09 October 2016 22:46 Go to previous message
Klugier is currently offline  Klugier
Messages: 1099
Registered: September 2012
Location: Poland, Kraków
Senior Contributor
Hello,

As I understand truncate flag in C++ standard library - it loads files and clear it. For example this line:
file.open(filename, ios::out | ios::trunc); // If not exists create - if exists clear.
file.close(); // Here we have got always empty file - even if file is not empty!


In the Upp framework you will achieve exactly the same with SaveFile(filePat, data) function. It will clear old file and put new content. So, equivalent to the upper code is:
SaveFile("text.txt", "");


Sincerely,
Klugier


U++ - one framework to rule them all.

[Updated on: Sun, 09 October 2016 22:47]

Report message to a moderator

 
Read Message
Read Message
Previous Topic: Refrences
Next Topic: Using a label as a link to a folder
Goto Forum:
  


Current Time: Fri May 02 00:21:38 CEST 2025

Total time taken to generate the page: 0.02943 seconds