Hi,
I am facing a problem to go to a particular folder ad access a file..
The code goes like this...
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
FILE *fp,*fs;
int main()
{
char name[8];
char command[20]="cd ";
printf("Enter absolute path for Directory to be changed :"
scanf("%s",name);
strcat(command,name);
fflush(stdin);
system(command);
fp=fopen("abc.txt","r"
if(fp==NULL)
{
printf("\nNo such file"
exit(1);
}
printf("\nFile opened successfully...."
return 1;
}
I am unable :-( to access file abc.txt in c:\abc\abc.txt.:-(
Thanks in advance
Sridhar
I am facing a problem to go to a particular folder ad access a file..
The code goes like this...
# include <stdio.h>
# include <string.h>
# include <stdlib.h>
FILE *fp,*fs;
int main()
{
char name[8];
char command[20]="cd ";
printf("Enter absolute path for Directory to be changed :"
scanf("%s",name);
strcat(command,name);
fflush(stdin);
system(command);
fp=fopen("abc.txt","r"
if(fp==NULL)
{
printf("\nNo such file"
exit(1);
}
printf("\nFile opened successfully...."
return 1;
}
I am unable :-( to access file abc.txt in c:\abc\abc.txt.:-(
Thanks in advance
Sridhar