4 Replies - 1458 Views - Last Post: 07 October 2009 - 02:12 PM Rate Topic: ****- 1 Votes

#1 vineetpanwar  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 07-October 09

file handling

Post icon  Posted 07 October 2009 - 10:55 AM

i am working on a project based student information management.i want to know how to delete a particular record saved in a file using file handling
Is This A Good Question/Topic? 0
  • +

Replies To: file handling

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6107
  • View blog
  • Posts: 23,662
  • Joined: 23-August 08

Re: file handling

Posted 07 October 2009 - 10:59 AM

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Post your code like this: :code:

Thanks.
Was This Post Helpful? 0
  • +
  • -

#3 taylorc8  Icon User is offline

  • B&

Reputation: 149
  • View blog
  • Posts: 1,572
  • Joined: 21-July 09

Re: file handling

Posted 07 October 2009 - 11:00 AM

View Postvineetpanwar, on 7 Oct, 2009 - 09:55 AM, said:

i am working on a project based student information management.i want to know how to delete a particular record saved in a file using file handling


what like file IO ?
C++ has a handy class in the fstream include file
try
#include <fstream>
fstream FILE;
FILE.open(etc...);
FILE.close();


Was This Post Helpful? 0
  • +
  • -

#4 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1112
  • View blog
  • Posts: 4,619
  • Joined: 09-June 09

Re: file handling

Posted 07 October 2009 - 01:43 PM

As from my knowlege you have to rewrite then entire file excluding what ever you want to delete
Was This Post Helpful? 0
  • +
  • -

#5 deery5000  Icon User is offline

  • D.I.C Addict

Reputation: 78
  • View blog
  • Posts: 979
  • Joined: 09-May 09

Re: file handling

Posted 07 October 2009 - 02:12 PM

Is this your own project or one that has been set for you?

The task you describe would be better suited if you used a container like a vector and use an iterator to find your record and delete it.

Maybe consider putting all your records into and array or vector and write them to file then find the record you wish to delete in the array or vector and rewrite the data to file

lots of information on vectors in cplusplus

Hope this helps
Kevin
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1