yes, you're right there was a typo. that fixed that part of the code but now, the code doesnt do what i want it to do.
basically,
there is some data that the user can either output to a file or the the screen.
the screen bit is easy.
then the user chooses a filename and that filename is checked for validity. that filename is then appended with the extension ".txt" and then it is checked to see if that exists. if it does exist then the user can either overwrite it or go back to the original loop of asking for the desired filename to be written.
im completely stuck. i guess i should be doing some sort of subroutining or something but i dont know the first thing about them!!! please help!