Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 118,691 C++ Programmers for FREE! Ask your question and get quick answers from experts. There are 1,160 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



Deleting and creating text files in C++

 
Reply to this topicStart new topic

Deleting and creating text files in C++

Pitufo
post 7 Aug, 2008 - 11:42 AM
Post #1


New D.I.C Head

*
Joined: 23 Jul, 2008
Posts: 23

How can you create a text file, write info in it, and then delete it. I know how to wright into it or extract info out of it, but I really don't know the code for creating or deleting txt files. Can someone please help me?
User is offlineProfile CardPM

Go to the top of the page


no2pencil
post 7 Aug, 2008 - 12:22 PM
Post #2


Wet D.I.C.

Group Icon
Joined: 10 May, 2007
Posts: 5,512



Thanked 36 times

Dream Kudos: 2350

Expert In: Goofing Off

My Contributions


The command fopen, when supplied with the "w" argument, will create an empty file for writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file. When the argument "w+" is used, fopen will create an empty file for both reading and writing. If a file with the same name already exists its content is erased and the file is treated as a new empty file.
User is offlineProfile CardPM

Go to the top of the page

Pitufo
post 7 Aug, 2008 - 12:52 PM
Post #3


New D.I.C Head

*
Joined: 23 Jul, 2008
Posts: 23

Can you please give me an example please?
User is offlineProfile CardPM

Go to the top of the page

PsychoCoder
post 7 Aug, 2008 - 12:53 PM
Post #4


using DIC.Core;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,918



Thanked 83 times

Dream Kudos: 8100

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI, Boo.Net

My Contributions


Here you go. Remember .... Google is your friend smile.gif
User is online!Profile CardPM

Go to the top of the page

Pitufo
post 8 Aug, 2008 - 08:52 AM
Post #5


New D.I.C Head

*
Joined: 23 Jul, 2008
Posts: 23

Thanks no2pencil and PsychoCoder...it works. You guys know your codes.
User is offlineProfile CardPM

Go to the top of the page

Reply to this topicStart new topic
Time is now: 10/12/08 08:03AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month