Hey Narue!
I need ur help on a upper-lower case switch problem..
Read the contents of a text file (using ifstream class)..
and create a new file or edit the same one (using ofstream class)
to switch the case of each char (upper to lower & vice versa)..

Thanks a bunch in advance

below is the code i tried but not working:

using namespace std;

int main()
ofstream lang("Batch6.txt");
lang<<"Pogram Name Shripal Parekh"<<endl;
lang<<"hELLO wORLD";
cout<<"File Created!\n";

ofstream newfile("SwitchedCases.txt");
ifstream rlang("Batch6.txt");
char ch=rlang.get();
cout<<' ';
return 0;

what is currently happening when you run this?

plz to add code tags to you code

It creates the 1st file: "Batch 6.txt" with the specified text..
The case switching works fine.. (I checked by using cout to get the output..)

But the 2nd file: "SwitchedCases.txt" gets create, without the desired output..

Hey Narue!

Why can't I have groupies? I'm sure she'll be thrilled with the shout-out.

Anyway... look at line 36 in relation to your while loop. Walk yourself through a cycle or two of the loop, noting when the file gets closed.

lol.. sorry didn mean 2 direct the thread at Narue alone.
(it was supposed 2 b reply to a post but i ended up creatin a new thread)..
anyways, u're ryt!! my silly mistake :(
was closing the file inside the loop..
thank u very very much :)