B
BHARAT
Hi I am a little bit new to C's advanced topics:
I need help in file handling.
I have Turbo C and I wrote a simple program to write data to file:
#include<stdio.h>
#include<dir.h>
#include<conio.h>
#include<stdlib.h>
// program to write your name to a file
void main()
{ FILE *pt;
char *b;
chdir("d:\test");
pt=fopen("bharat.text","w");
printf("ENter ur name ");
scanf(" %[^\n]",b);
fprintf(pt," %s",b);
fclose(pt);
getch();
}
When I executed the program, a new file("bharat.text")was created in
the BIN directory under the Turbo C directory. I wish that the file
should be created in "D:\TEST" folder.
Can any one tell me how to do that?
I need help in file handling.
I have Turbo C and I wrote a simple program to write data to file:
#include<stdio.h>
#include<dir.h>
#include<conio.h>
#include<stdlib.h>
// program to write your name to a file
void main()
{ FILE *pt;
char *b;
chdir("d:\test");
pt=fopen("bharat.text","w");
printf("ENter ur name ");
scanf(" %[^\n]",b);
fprintf(pt," %s",b);
fclose(pt);
getch();
}
When I executed the program, a new file("bharat.text")was created in
the BIN directory under the Turbo C directory. I wish that the file
should be created in "D:\TEST" folder.
Can any one tell me how to do that?