File Processing 2

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2004
Posts: 65
Reputation: koh is an unknown quantity at this point 
Solved Threads: 0
koh koh is offline Offline
Junior Poster in Training

File Processing 2

 
0
  #1
Apr 6th, 2005
In file proceesing

how can i find the renamed file....

meaning....i created 2 files named derrick.txt and alex.txt

and in the program when i input derrick, the program will look for the file derrick and open the file,

and if i enter alex, the program will look for alex.txt


thank you
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,734
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 738
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: File Processing 2

 
0
  #2
Apr 6th, 2005
If the file is in the current working directory, it's just a matter of tacking on the extension and opening the file:
  1. string name = "derrick";
  2.  
  3. ifstream in ( ( name + ".txt." ).c_str() );
If the file is not in the current working directory, you must supply the path to the file as well as the file name. How you go about that depends on the needs of your application, but a good generic method is to ask the user for a path in one way or another.

Be more specific instead of just copying what you asked in your other thread.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 65
Reputation: koh is an unknown quantity at this point 
Solved Threads: 0
koh koh is offline Offline
Junior Poster in Training

Re: File Processing 2

 
0
  #3
Apr 6th, 2005
thanks and sorry
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC