help file handling

I'm abhishek, I'm new here!
I'm writing a programme for writing data to the file.
This is my code:

#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<string.h>
#include<stdio.h>
void main(){
clrscr();
ofstream f;
f.open("d:\\test.txt");
char nm[100];
cout<<"\n name";
cin>>nm;
f<<"name"<<nm;
f.close();
getch();

}

this programme should write text to the test.txt file by creating file named test.txt in "d" drive, but it is creating test.txt in "C:\TurboC++\Disk".

please help
While I'm unfamiliar with TurboC++ (I use MinGW/GCC & clang/llvm), it could be a permissions issue. Compile your program and try run it as administrator manually through the file manager. If this works, tell it to write in a normal user accessible directory, such as the documents directory.
Hi,

the solution to your problem is to ditch turbo c++ and download a non-antique IDE :

http://codelite.org/
Thank you, sir. I tried to run it mannualy and it worked.
Topic archived. No new replies allowed.