Wrox Programmer Forums
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 24th, 2005, 10:13 AM
Authorized User
Join Date: Jan 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default c++ file handling.

im writing a program that deals with multple files actually....
first i have a file called Text.text that contains the follwoing :

The Senior Project in RIT's undergraduate Software Engineering curriculum provides
a capstone design experience for every graduate of the program.
The project's educational value is greatest if the project is
for a real customer who needs a software system developed.
The Department of Software Engineering actively solicits external industrial

what im trying to do is to write a c++ code that reads this file and go through each line and delete the following words : if -is-as-to-for-the. then store the modified text "like every sentence in new line" in a new file called NewFile.text
the code i have wrtten so far only displays whats in the file..but it doesnt do anyof the deletion stuff.....can any one help me,please?

Reply With Quote
  #2 (permalink)  
Old March 11th, 2005, 02:40 AM
Friend of Wrox
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post

I don't know anything about C++(really I'm forgetting it)..
but mainly you should first read your text file to end and push it in a string variable then work on that string for replacing your text and write your changed string to a new file.(here you should write replace function if you cant use any special function in STL)

software student.
Reply With Quote
  #3 (permalink)  
Old March 23rd, 2005, 07:13 PM
Registered User
Join Date: Mar 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

You should include a loop like this.
/* read file stuff here */
if(ch == if||"whatever you wanna delete from file");
   delete ch;

Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
here is my code c++ file handling amahja56 C++ Programming 2 November 23rd, 2007 07:25 AM
File strorage handling using JSP draggy Pro JSP 4 July 30th, 2006 12:44 PM
File handling vijayma VB How-To 3 June 7th, 2006 01:30 AM
FILE HANDLING yojeiram_n1 C++ Programming 2 March 13th, 2006 02:57 PM
FILE HANDLING sanchita ADO.NET 8 November 8th, 2004 12:34 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.