473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

C++, How do I overwrite a .txt file?

29
I am trying to overwrite an ifstream file with an ofstream file. How do I do this?
Nov 11 '10 #1
2 20206
tlhintoq
3,525 Expert 2GB
If the source file exists before you start writting... delete it.
Nov 11 '10 #2
mac11
256 100+
ofstream constructor allows you to specify truncation mode, see http://cplusplus.com/reference/iostr...ream/ofstream/
Nov 11 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Gord | last post by:
Hello, If you set the flag for an overwrite prompt using the 'Save' common dialog, how do you read the response when the user clicks the Yes or No in the 'overwrite' message box? Everything...
5
by: Clint Stowers | last post by:
Access 2k Exporting a Query to as an excel file. No problem. However, I keep getting the warning that the file already exists, Overwrite Yes/No. Yes, I want to overwrite the file. ...
6
by: Tom | last post by:
I am having trouble when I read a file and another process is trying to update it. So I need a rountine to copy a file in asp.net. Can anyone assist? Thanks Tom
2
by: B-Dog | last post by:
Is there a way to make vb.net to overwrite the file when moving? Here is what I'm trying to do: If System.IO.File.Exists(dest) Then 'handle overwrite here If MessageBox.Show("Do you want...
8
by: Peter | last post by:
I'm trying to write a proceedure that will delete a file completely off a hardrive. I just don't want to kill the file. I want to rewrite over the data with 1's and 0's 8 times. Anyone have an...
3
by: Gene Vangampelaere | last post by:
Hi, I need to write a function that can replace some (.dll) files. That's easy to do but what if there are some files in use ? How can I replace those files ? is there a method to 'force' an...
26
by: Army1987 | last post by:
Is this a good way to check wheter a file already exists? #include <stdio.h> #include <stdlib.h> int ask(const char *prompt); typedef char filename; int main(int argc, char *argv) { FILE...
2
by: aigi | last post by:
hi! I have a question: How can I overwrite file on ftp server? I'm learning c# so please can U help me?
4
by: jcor | last post by:
Hi, I have a script that convert a file, "$novo" in this case, to a 3gp file: this is part of the script: print "qual é o título da peça? (< 36 caracteres)\n"; my $titul=<STDIN>;...
8
by: Joe Duchtel | last post by:
Hello - I have the following code to detemine a file name when my application is saving a file. The problem is that if the file already exists and I select the Yes button in the "Do you want to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.