Member Avatar for kohkohkoh

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

If the file is in the current working directory, it's just a matter of tacking on the extension and opening the file:

string name = "derrick";

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.

Member Avatar for kohkohkoh

thanks and sorry :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.